Skip to content

Commit ef2a1e3

Browse files
Fix initialization error when using default blockfilterindex value
When blockfilterindex defaults to "basic" but no explicit command line argument is provided, GetArgs("-blockfilterindex") returns an empty vector. This caused the validation logic to fail with "Cannot set -peerblockfilters without -blockfilterindex" error. Add check for empty names vector and use the default value when needed.
1 parent fbde721 commit ef2a1e3

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/init.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1143,7 +1143,11 @@ bool AppInitParameterInteraction(const ArgsManager& args)
11431143
if (blockfilterindex_value == "" || blockfilterindex_value == "1") {
11441144
g_enabled_filter_types = AllBlockFilterTypes();
11451145
} else if (blockfilterindex_value != "0") {
1146-
const std::vector<std::string> names = args.GetArgs("-blockfilterindex");
1146+
std::vector<std::string> names = args.GetArgs("-blockfilterindex");
1147+
if (names.empty()) {
1148+
// Use default value when no explicit -blockfilterindex was provided
1149+
names.push_back(DEFAULT_BLOCKFILTERINDEX);
1150+
}
11471151
for (const auto& name : names) {
11481152
BlockFilterType filter_type;
11491153
if (!BlockFilterTypeByName(name, filter_type)) {

0 commit comments

Comments
 (0)