Skip to content

Conversation

@PastaPastaPasta
Copy link
Member

@PastaPastaPasta PastaPastaPasta commented Jun 5, 2025

Issue being fixed or feature implemented

This pull request introduces automatic enabling of BIP157 compact block filters specifically for masternodes to improve privacy and functionality for light clients connecting to them. Regular nodes retain the existing default settings.

What was done?

  • Automatic Enablement for Masternodes: When a node is configured as a masternode (via -masternodeblsprivkey), both -peerblockfilters and -blockfilterindex=basic are now automatically enabled.
  • Regular Nodes Unchanged: Regular (non-masternode) nodes keep the previous defaults with both options disabled (-peerblockfilters=false and -blockfilterindex=0).
  • Opt-out Available: Masternodes can still explicitly disable these features if needed by setting -peerblockfilters=0 or -blockfilterindex=0.
  • Release Notes: Updated to clearly document this masternode-specific behavior and the ~1GB disk space requirement for the block filter index.
  • Tests: Added functional test to verify the parameter interactions and that the settings are correctly applied only to masternodes.

How Has This Been Tested?

  • Built locally
  • Added new functional test feature_masternode_params.py that verifies:
    • Regular nodes have filters disabled by default
    • Masternodes have filters auto-enabled
    • Masternodes can explicitly disable filters
    • Parameter interaction logging works correctly

Breaking Changes

None - this only affects masternodes and they can opt out if needed.

Checklist:

Go over all the following points, and put an x in all the boxes that apply.

  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have added or updated relevant unit/integration/functional/e2e tests
  • I have made corresponding changes to the documentation
  • I have assigned this pull request to a milestone (for repository code-owners and collaborators only)

@PastaPastaPasta PastaPastaPasta added this to the 23 milestone Jun 5, 2025
@coderabbitai
Copy link

coderabbitai bot commented Jun 5, 2025

Walkthrough

When a node is configured as a masternode via -masternodeblsprivkey, the build now soft-sets -peerblockfilters=1 and -blockfilterindex=basic and logs those actions. Help text for -blockfilterindex and -peerblockfilters in src/init.cpp was extended to note the automatic enabling for masternodes. Release notes document the change. A new functional test (test/functional/feature_masternode_params.py) checks regular-node defaults, automatic enabling for masternodes, explicit disablement with -peerblockfilters=0 and -blockfilterindex=0, and the presence of the expected log entry. test_runner.py was updated to include the new test in EXTENDED_SCRIPTS.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Tip

🔌 Remote MCP (Model Context Protocol) integration is now available!

Pro plan users can now connect to remote MCP servers from the Integrations page. Connect with popular remote MCPs such as Notion and Linear to add more context to your reviews and chats.


📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

💡 Knowledge Base configuration:

  • MCP integration is disabled by default for public repositories
  • Jira integration is disabled by default for public repositories
  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between bcff97a and 2b17480.

📒 Files selected for processing (1)
  • test/functional/test_runner.py (1 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
test/functional/**/*.py

📄 CodeRabbit Inference Engine (CLAUDE.md)

Functional tests should be written in Python and placed in test/functional/

Files:

  • test/functional/test_runner.py
🧠 Learnings (2)
📓 Common learnings
Learnt from: kwvg
PR: dashpay/dash#6718
File: test/functional/test_framework/test_framework.py:2102-2102
Timestamp: 2025-06-09T16:43:20.996Z
Learning: In the test framework consolidation PR (#6718), user kwvg prefers to limit functional changes to those directly related to MasternodeInfo, avoiding scope creep even for minor improvements like error handling consistency.
📚 Learning: 2025-06-09T16:43:20.996Z
Learnt from: kwvg
PR: dashpay/dash#6718
File: test/functional/test_framework/test_framework.py:2102-2102
Timestamp: 2025-06-09T16:43:20.996Z
Learning: In the test framework consolidation PR (#6718), user kwvg prefers to limit functional changes to those directly related to MasternodeInfo, avoiding scope creep even for minor improvements like error handling consistency.

Applied to files:

  • test/functional/test_runner.py
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (7)
  • GitHub Check: x86_64-w64-mingw32 / Build depends
  • GitHub Check: Lint / Run linters
  • GitHub Check: x86_64-pc-linux-gnu_multiprocess / Build depends
  • GitHub Check: x86_64-pc-linux-gnu_nowallet / Build depends
  • GitHub Check: x86_64-apple-darwin / Build depends
  • GitHub Check: arm-linux-gnueabihf / Build depends
  • GitHub Check: x86_64-pc-linux-gnu / Build depends
🔇 Additional comments (1)
test/functional/test_runner.py (1)

141-141: Confirm intended placement of feature_masternode_params.py in BASE vs EXTENDED

The test feature_masternode_params.py is currently listed in BASE_SCRIPTS (line 141 of test/functional/test_runner.py), but the PR summary indicates it should live under EXTENDED_SCRIPTS. Please confirm your intention:

  • If you want it to run by default (BASE): no change required.
  • If you intended it only for extended runs:
    1. Remove from BASE_SCRIPTS:
      --- a/test/functional/test_runner.py
      +++ b/test/functional/test_runner.py
      @@ -139,7 +139,6 @@ BASE_SCRIPTS = [
           'feature_mnehf.py', # NOTE: needs dash_hash to pass
      -    'feature_masternode_params.py', # NOTE: needs dash_hash to pass
           'feature_governance.py --legacy-wallet',
           'feature_governance.py --descriptors',
       ]
    2. Add to EXTENDED_SCRIPTS (maintaining order):
      --- a/test/functional/test_runner.py
      +++ b/test/functional/test_runner.py
      @@ -47,6 +47,7 @@ EXTENDED_SCRIPTS = [
           'feature_dbcrash.py',
           'feature_index_prune.py',
      +    'feature_masternode_params.py', # NOTE: needs dash_hash to pass
       ]

There are no unused assert_equal imports in test/functional/feature_masternode_params.py; the linter is satisfied.

✨ Finishing Touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

CodeRabbit Commands (Invoked using PR/Issue comments)

Type @coderabbitai help to get the list of available commands.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Status, Documentation and Community

  • Visit our Status Page to check the current availability of CodeRabbit.
  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

PastaPastaPasta and others added 5 commits July 16, 2025 01:08
This change enables compact block filters (BIP157) functionality by default:
- Sets DEFAULT_BLOCKFILTERINDEX to "basic" instead of "0"
- Sets DEFAULT_PEERBLOCKFILTERS to true instead of false

This improves privacy for light clients and enables better pruned node support.
Documents the change to enable BIP157 block filters by default.
Updates the release notes file name and PR reference from 6708 to 6711.
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.
Three tests needed updates to work with the new defaults where
-blockfilterindex=basic and -peerblockfilters=true:

- p2p_blockfilters.py: Explicitly disable peerblockfilters for node 1
  which doesn't serve compact filters
- rpc_getblockfilter.py: Explicitly disable both options for nodes that
  should not have block filter index
- rpc_misc.py: Explicitly disable both options when testing the absence
  of indices

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <[email protected]>
@PastaPastaPasta PastaPastaPasta force-pushed the enable-bip157-filters-by-default branch from 9663948 to e6e9ff8 Compare July 16, 2025 07:22
PastaPastaPasta and others added 3 commits July 16, 2025 14:18
…faults

Node 1 was configured with only -coinstatsindex=1, but with the new
defaults it was also getting -blockfilterindex=basic enabled. The test
expects node 1 to only have coinstatsindex, so we need to explicitly
disable blockfilterindex and peerblockfilters.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <[email protected]>
When BIP157 filters are enabled by default, the restart_without_indices
function needs to explicitly disable both blockfilterindex and
coinstatsindex to avoid conflicts with pruning.
With peerblockfilters now enabled by default, the test must explicitly
disable it when disabling blockfilterindex to avoid initialization errors.

Co-Authored-By: Claude <[email protected]>
@github-actions
Copy link

github-actions bot commented Jul 18, 2025

✅ No Merge Conflicts Detected

This PR currently has no conflicts with other open PRs.

PastaPastaPasta and others added 2 commits August 12, 2025 01:10
The PR enables peerblockfilters=1 by default, which also enables
blockfilterindex. This is incompatible with -reindex-chainstate.

Add -blockfilterindex=0 to tests that use -reindex-chainstate to
ensure they can run successfully with the new default.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <[email protected]>
Instead of enabling peerblockfilters by default for all nodes, this change:
- Keeps DEFAULT_PEERBLOCKFILTERS as false (unchanged from current behavior)
- Automatically enables peerblockfilters and blockfilterindex for masternodes
- Allows masternodes to still explicitly disable with -peerblockfilters=0

This approach:
- Deploys block filters to the nodes that provide the majority of network services
- Avoids breaking changes for regular nodes
- Follows existing Dash patterns (like auto-disabling wallet for masternodes)
- Eliminates the need for extensive test suite modifications

The parameter interaction happens in InitParameterInteraction() where
masternodes (identified by -masternodeblsprivkey) automatically get:
- peerblockfilters=1
- blockfilterindex=basic

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <[email protected]>
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

🔭 Outside diff range comments (1)
src/init.cpp (1)

1150-1167: Harden multi-arg parsing for “-blockfilterindex”

Recognize any empty (-blockfilterindex) or “1” entries in a mixed list as “all types” to avoid spurious “Unknown … value” errors when users combine -blockfilterindex forms.

Locations:

  • src/init.cpp around lines 1150–1167

Recommended diff:

     // parse and validate enabled filter types
     std::string blockfilterindex_value = args.GetArg("-blockfilterindex", DEFAULT_BLOCKFILTERINDEX);
     if (blockfilterindex_value == "" || blockfilterindex_value == "1") {
         g_enabled_filter_types = AllBlockFilterTypes();
     } else if (blockfilterindex_value != "0") {
-        std::vector<std::string> names = args.GetArgs("-blockfilterindex");
-        if (names.empty()) {
-            // Use default value when no explicit -blockfilterindex was provided
-            names.push_back(DEFAULT_BLOCKFILTERINDEX);
-        }
-        for (const auto& name : names) {
-            BlockFilterType filter_type;
-            if (!BlockFilterTypeByName(name, filter_type)) {
-                return InitError(strprintf(_("Unknown -blockfilterindex value %s."), name));
-            }
-            g_enabled_filter_types.insert(filter_type);
-        }
+        std::vector<std::string> names = args.GetArgs("-blockfilterindex");
+        if (names.empty()) {
+            // No explicit entries: fall back to the default type
+            names.push_back(DEFAULT_BLOCKFILTERINDEX);
+        }
+        // If any entry is empty or "1", treat as “all types”
+        bool any_all = std::any_of(names.begin(), names.end(),
+            [](const std::string& n){ return n.empty() || n == "1"; });
+        if (any_all) {
+            g_enabled_filter_types = AllBlockFilterTypes();
+        } else {
+            for (const auto& name : names) {
+                BlockFilterType filter_type;
+                if (!BlockFilterTypeByName(name, filter_type)) {
+                    return InitError(strprintf(_("Unknown -blockfilterindex value %s."), name));
+                }
+                g_enabled_filter_types.insert(filter_type);
+            }
+        }
     }
🧹 Nitpick comments (2)
src/init.cpp (2)

1029-1031: Use DEFAULT_BLOCKFILTERINDEX instead of hardcoded "basic" for consistency

Prefer the constant over a literal to avoid divergence if the default is adjusted later.

Apply this diff:

-        if (args.SoftSetArg("-blockfilterindex", "basic")) {
-            LogPrintf("%s: parameter interaction: -masternodeblsprivkey set -> setting -blockfilterindex=basic\n", __func__);
+        if (args.SoftSetArg("-blockfilterindex", DEFAULT_BLOCKFILTERINDEX)) {
+            LogPrintf("%s: parameter interaction: -masternodeblsprivkey set -> setting -blockfilterindex=%s\n", __func__, DEFAULT_BLOCKFILTERINDEX);
         }

1025-1031: Minor: Soft-setting -peerblockfilters may be redundant now that it defaults to true

With DEFAULT_PEERBLOCKFILTERS flipped to true, this SoftSetBoolArg typically won’t change anything. Keeping it is harmless and documents intent, but consider dropping it to reduce noise, or add a short comment noting it’s a no-op when using defaults.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between d6c11f0 and 90ef2d5.

📒 Files selected for processing (1)
  • src/init.cpp (2 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
src/**/*.{cpp,h,cc,cxx,hpp}

📄 CodeRabbit Inference Engine (CLAUDE.md)

src/**/*.{cpp,h,cc,cxx,hpp}: Dash Core C++ codebase must be written in C++20 and require at least Clang 16 or GCC 11.1
Dash uses unordered_lru_cache for efficient caching with LRU eviction

Files:

  • src/init.cpp
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (7)
  • GitHub Check: arm-linux-gnueabihf / Build depends
  • GitHub Check: x86_64-pc-linux-gnu_nowallet / Build depends
  • GitHub Check: x86_64-pc-linux-gnu_multiprocess / Build depends
  • GitHub Check: Lint / Run linters
  • GitHub Check: x86_64-w64-mingw32 / Build depends
  • GitHub Check: x86_64-apple-darwin / Build depends
  • GitHub Check: x86_64-pc-linux-gnu / Build depends
🔇 Additional comments (1)
src/init.cpp (1)

1021-1031: Good parameter interaction for masternodes: enabling filters aligns with serving BIP157

Enabling -peerblockfilters and -blockfilterindex=basic when -masternodeblsprivkey is set ensures masternodes can advertise and serve compact filters. This pairs well with the later validation that requires Bloom filters and txindex for masternodes.

- Update release notes to accurately describe masternode-only behavior
- Revert DEFAULT_BLOCKFILTERINDEX back to "0" (non-masternodes don't need it)
- Add help text mentioning automatic enabling for masternodes
- Add functional test to verify masternode parameter interactions
- Remove unnecessary code for handling empty blockfilterindex names

These changes ensure the feature is properly documented and tested,
while keeping the implementation focused on masternodes only.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <[email protected]>
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 4

🧹 Nitpick comments (3)
src/init.cpp (1)

558-560: Help text addition looks good; minor wording nit

The new guidance is helpful. Minor nit: consider quoting the literal value for clarity (“if is not supplied or if = '1' …”).

Apply this minimal tweak to improve readability:

-                 " If <type> is not supplied or if <type> = 1, indexes for all known types are enabled." +
+                 " If <type> is not supplied or if <type> = '1', indexes for all known types are enabled." +
test/functional/feature_masternode_params.py (2)

12-12: Remove unused import flagged by linters

assert_equal is imported but unused. This triggers Ruff/Flake8 F401.

Apply this diff:

-from test_framework.util import assert_equal

58-63: Explicit disable scenario looks good; keep -txindex=1 to satisfy masternode constraints

Even when disabling filters, node1 is still a masternode; keep -txindex=1 to satisfy startup checks.

Apply this diff:

         self.restart_node(1, extra_args=[
             f"-masternodeblsprivkey={bls_key}",
+            "-txindex=1",
             "-peerblockfilters=0",
             "-blockfilterindex=0"
         ])
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 90ef2d5 and 2fabaa9.

📒 Files selected for processing (3)
  • doc/release-notes-6711.md (1 hunks)
  • src/init.cpp (3 hunks)
  • test/functional/feature_masternode_params.py (1 hunks)
🧰 Additional context used
📓 Path-based instructions (3)
test/functional/**/*.py

📄 CodeRabbit Inference Engine (CLAUDE.md)

Functional tests should be written in Python and placed in test/functional/

Files:

  • test/functional/feature_masternode_params.py
doc/**

📄 CodeRabbit Inference Engine (CLAUDE.md)

Unless specifically prompted, avoid making changes to the doc directory (documentation)

Files:

  • doc/release-notes-6711.md
src/**/*.{cpp,h,cc,cxx,hpp}

📄 CodeRabbit Inference Engine (CLAUDE.md)

src/**/*.{cpp,h,cc,cxx,hpp}: Dash Core C++ codebase must be written in C++20 and require at least Clang 16 or GCC 11.1
Dash uses unordered_lru_cache for efficient caching with LRU eviction

Files:

  • src/init.cpp
🧠 Learnings (1)
📚 Learning: 2025-06-09T16:43:20.996Z
Learnt from: kwvg
PR: dashpay/dash#6718
File: test/functional/test_framework/test_framework.py:2102-2102
Timestamp: 2025-06-09T16:43:20.996Z
Learning: In the test framework consolidation PR (#6718), user kwvg prefers to limit functional changes to those directly related to MasternodeInfo, avoiding scope creep even for minor improvements like error handling consistency.

Applied to files:

  • test/functional/feature_masternode_params.py
🧬 Code Graph Analysis (1)
test/functional/feature_masternode_params.py (3)
test/functional/test_framework/test_framework.py (1)
  • BitcoinTestFramework (101-1130)
test/functional/test_framework/util.py (1)
  • assert_equal (69-74)
test/functional/test_framework/test_node.py (1)
  • debug_log_path (432-433)
🪛 Ruff (0.12.2)
test/functional/feature_masternode_params.py

12-12: test_framework.util.assert_equal imported but unused

Remove unused import: test_framework.util.assert_equal

(F401)

🪛 Flake8 (7.2.0)
test/functional/feature_masternode_params.py

[error] 12-12: 'test_framework.util.assert_equal' imported but unused

(F401)

⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (7)
  • GitHub Check: Lint / Run linters
  • GitHub Check: x86_64-w64-mingw32 / Build depends
  • GitHub Check: x86_64-apple-darwin / Build depends
  • GitHub Check: x86_64-pc-linux-gnu / Build depends
  • GitHub Check: arm-linux-gnueabihf / Build depends
  • GitHub Check: x86_64-pc-linux-gnu_multiprocess / Build depends
  • GitHub Check: x86_64-pc-linux-gnu_nowallet / Build depends
🔇 Additional comments (4)
doc/release-notes-6711.md (1)

4-8: Clarify whether global defaults changed or only masternode auto-enable is intended

Release notes say regular nodes keep previous defaults (disabled) and only masternodes auto-enable filters. However, the PR objectives claim changing global defaults: -blockfilterindex default from 0 to basic and -peerblockfilters default from false to true. Please confirm intent and align docs and code accordingly.

Would you like me to update the notes once we confirm whether defaults changed globally or only masternode auto-enabling is desired?

src/init.cpp (2)

591-591: Help text correctly mentions masternode auto-enable

The addition clearly communicates the masternode behavior. No functional concerns here.


1022-1033: Defaults Verified: peerblockfilters=false, blockfilterindex="0"
Confirmed DEFAULT_PEERBLOCKFILTERS is false (src/net_processing.h:36) and DEFAULT_BLOCKFILTERINDEX is "0" (src/validation.h:82). In AppInitParameterInteraction, setting -masternodeblsprivkey soft-sets both -peerblockfilters=true and -blockfilterindex=basic, so the BASIC filter is enabled before the peer-filters check. Regular nodes retain defaults (both disabled), so there are no startup regressions.

test/functional/feature_masternode_params.py (1)

69-72: Index key check may be brittle; prefer a contains check

RPC getindexinfo keys vary (“basic block filter index” vs similar). Checking for exact 'basic filter index' may be fragile.

Consider this more robust check:

-        assert 'basic filter index' not in index_info
+        assert not any(('filter' in k and 'basic' in k) for k in index_info.keys())

If you prefer exact matching, verify the exact key used in this branch via the logged keys one line above and assert on that.

Comment on lines +1022 to 1033
if (args.IsArgSet("-masternodeblsprivkey")) {
if (args.SoftSetBoolArg("-disablewallet", true)) {
LogPrintf("%s: parameter interaction: -masternodeblsprivkey set -> setting -disablewallet=1\n", __func__);
}
// Enable block filters for masternodes to improve network services
if (args.SoftSetBoolArg("-peerblockfilters", true)) {
LogPrintf("%s: parameter interaction: -masternodeblsprivkey set -> setting -peerblockfilters=1\n", __func__);
}
if (args.SoftSetArg("-blockfilterindex", "basic")) {
LogPrintf("%s: parameter interaction: -masternodeblsprivkey set -> setting -blockfilterindex=basic\n", __func__);
}
}
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion

Good parameter interaction for masternodes; ensure parsing supports a non-“0” default for -blockfilterindex

Soft-setting -peerblockfilters=1 and -blockfilterindex=basic for masternodes is correct and the logging is consistent with other interactions.

However, if the project ever changes DEFAULT_BLOCKFILTERINDEX to a non-“0” value (e.g., “basic”), the current parsing in AppInitParameterInteraction uses GetArgs("-blockfilterindex") and won’t populate g_enabled_filter_types when the value is coming from the default. That would cause NODE_COMPACT_FILTERS not to be signaled by default and produce a mismatch between help/intent and behavior.

Suggestion: make the parsing robust to defaults by treating the default value as an explicit name when the user hasn’t provided the arg.

Outside the changed region, adjust the parsing around AppInitParameterInteraction where blockfilterindex is processed:

// Current (around lines 1152-1164):
std::string blockfilterindex_value = args.GetArg("-blockfilterindex", DEFAULT_BLOCKFILTERINDEX);
if (blockfilterindex_value == "" || blockfilterindex_value == "1") {
    g_enabled_filter_types = AllBlockFilterTypes();
} else if (blockfilterindex_value != "0") {
    const std::vector<std::string> names = args.GetArgs("-blockfilterindex");
    for (const auto& name : names) {
        BlockFilterType filter_type;
        if (!BlockFilterTypeByName(name, filter_type)) {
            return InitError(strprintf(_("Unknown -blockfilterindex value %s."), name));
        }
        g_enabled_filter_types.insert(filter_type);
    }
}

// Suggested:
std::string blockfilterindex_value = args.GetArg("-blockfilterindex", DEFAULT_BLOCKFILTERINDEX);
if (blockfilterindex_value == "" || blockfilterindex_value == "1") {
    g_enabled_filter_types = AllBlockFilterTypes();
} else if (blockfilterindex_value != "0") {
    // If the user did not explicitly set -blockfilterindex, treat the default
    // value as a single requested type (e.g., "basic").
    std::vector<std::string> names = args.IsArgSet("-blockfilterindex")
        ? args.GetArgs("-blockfilterindex")
        : std::vector<std::string>{blockfilterindex_value};
    for (const auto& name : names) {
        BlockFilterType filter_type;
        if (!BlockFilterTypeByName(name, filter_type)) {
            return InitError(strprintf(_("Unknown -blockfilterindex value %s."), name));
        }
        g_enabled_filter_types.insert(filter_type);
    }
}

This keeps current behavior intact and future-proofs the code if defaults are changed centrally.

🤖 Prompt for AI Agents
In src/init.cpp around lines 1022 to 1033 and the AppInitParameterInteraction
parsing region (around lines ~1152-1164), the code currently reads
GetArgs("-blockfilterindex") only when parsing user-provided values, which
misses treating a non-"0" DEFAULT_BLOCKFILTERINDEX as an explicit filter type;
update the parsing so that if -blockfilterindex is not explicitly set
(args.IsArgSet("-blockfilterindex") is false) you treat the single returned
GetArg("-blockfilterindex", DEFAULT_BLOCKFILTERINDEX) value as the requested
name (wrap it in a one-element vector) and otherwise continue using
args.GetArgs("-blockfilterindex"); then validate each name with
BlockFilterTypeByName and insert into g_enabled_filter_types as before so
defaults like "basic" are correctly honored.

Comment on lines 41 to 44
self.restart_node(1, extra_args=[f"-masternodeblsprivkey={bls_key}"])
node1 = self.nodes[1]

# Masternode should have peerblockfilters enabled
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

Masternode start will fail without -txindex=1 (and bloom filters, if not default); add required args

AppInitParameterInteraction enforces that a masternode must have -txindex=1 (and -peerbloomfilters=1 if not already default). Without -txindex=1 the restart is expected to fail.

Apply this diff to ensure node1 starts as a masternode:

-        self.restart_node(1, extra_args=[f"-masternodeblsprivkey={bls_key}"])
+        self.restart_node(1, extra_args=[
+            f"-masternodeblsprivkey={bls_key}",
+            "-txindex=1",
+            "-peerbloomfilters=1",
+        ])

If -peerbloomfilters is already true by default in this branch, you can omit that line; keeping it explicit avoids flakiness across branches.

📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
self.restart_node(1, extra_args=[f"-masternodeblsprivkey={bls_key}"])
node1 = self.nodes[1]
# Masternode should have peerblockfilters enabled
self.restart_node(1, extra_args=[
f"-masternodeblsprivkey={bls_key}",
"-txindex=1",
"-peerbloomfilters=1",
])
node1 = self.nodes[1]
# Masternode should have peerblockfilters enabled
🤖 Prompt for AI Agents
In test/functional/feature_masternode_params.py around lines 41 to 44, the
masternode restart omits required node args so startup will fail; update the
restart_node call to include -txindex=1 and also -peerbloomfilters=1 (in
addition to the existing -masternodeblsprivkey) so node1 meets
AppInitParameterInteraction requirements; if this branch already defaults
peerbloomfilters to true you may omit that flag, but keep -txindex=1 explicitly
to avoid flakiness.

Comment on lines 45 to 54
services = int(node1.getnetworkinfo()['localservices'], 16)
self.log.info(f"Masternode services: {hex(services)}, has COMPACT_FILTERS: {services & NODE_COMPACT_FILTERS != 0}")

# Check blockfilterindex
index_info = node1.getindexinfo()
self.log.info(f"Masternode indexes: {list(index_info.keys())}")

# For now, just check that the node started successfully with masternode key
# The actual filter enabling might require the node to be fully synced
assert node1.getblockcount() >= 0 # Basic check that node is running
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion

Assert masternode gets NODE_COMPACT_FILTERS and a basic filter index when auto-enabled

Right now this section only logs values and has a weak liveness check. Given this PR’s goal, we should assert the service bit and that a basic filter index is present.

Apply this diff:

-        services = int(node1.getnetworkinfo()['localservices'], 16)
-        self.log.info(f"Masternode services: {hex(services)}, has COMPACT_FILTERS: {services & NODE_COMPACT_FILTERS != 0}")
-        
-        # Check blockfilterindex
-        index_info = node1.getindexinfo()
-        self.log.info(f"Masternode indexes: {list(index_info.keys())}")
-        
-        # For now, just check that the node started successfully with masternode key
-        # The actual filter enabling might require the node to be fully synced
-        assert node1.getblockcount() >= 0  # Basic check that node is running
+        services = int(node1.getnetworkinfo()['localservices'], 16)
+        self.log.info(f"Masternode services: {hex(services)}, has COMPACT_FILTERS: {services & NODE_COMPACT_FILTERS != 0}")
+        assert services & NODE_COMPACT_FILTERS != 0
+
+        # Check that a basic block filter index exists
+        index_info = node1.getindexinfo()
+        self.log.info(f"Masternode indexes: {list(index_info.keys())}")
+        # Be robust to naming: look for any key that contains 'filter' and 'basic'
+        assert any(('filter' in k and 'basic' in k) for k in index_info.keys())
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
services = int(node1.getnetworkinfo()['localservices'], 16)
self.log.info(f"Masternode services: {hex(services)}, has COMPACT_FILTERS: {services & NODE_COMPACT_FILTERS != 0}")
# Check blockfilterindex
index_info = node1.getindexinfo()
self.log.info(f"Masternode indexes: {list(index_info.keys())}")
# For now, just check that the node started successfully with masternode key
# The actual filter enabling might require the node to be fully synced
assert node1.getblockcount() >= 0 # Basic check that node is running
services = int(node1.getnetworkinfo()['localservices'], 16)
self.log.info(f"Masternode services: {hex(services)}, has COMPACT_FILTERS: {services & NODE_COMPACT_FILTERS != 0}")
assert services & NODE_COMPACT_FILTERS != 0
# Check that a basic block filter index exists
index_info = node1.getindexinfo()
self.log.info(f"Masternode indexes: {list(index_info.keys())}")
# Be robust to naming: look for any key that contains 'filter' and 'basic'
assert any(('filter' in k and 'basic' in k) for k in index_info.keys())

Comment on lines 75 to 77
with open(node1.debug_log_path, 'r') as f:
log_content = f.read()
assert "parameter interaction: -masternodeblsprivkey set -> setting -disablewallet=1" in log_content
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

Fix debug log path usage (method vs attribute)

In the framework, debug_log_path is a method, not a property. Opening it without parentheses will fail.

Apply this diff:

-        with open(node1.debug_log_path, 'r') as f:
+        with open(node1.debug_log_path(), 'r') as f:

Optionally, you could also add an earlier check (before the explicit-disable restart) to assert that the auto-enable log lines are present:

  • "parameter interaction: -masternodeblsprivkey set -> setting -peerblockfilters=1"
  • "parameter interaction: -masternodeblsprivkey set -> setting -blockfilterindex=basic"
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
with open(node1.debug_log_path, 'r') as f:
log_content = f.read()
assert "parameter interaction: -masternodeblsprivkey set -> setting -disablewallet=1" in log_content
with open(node1.debug_log_path(), 'r') as f:
log_content = f.read()
assert "parameter interaction: -masternodeblsprivkey set -> setting -disablewallet=1" in log_content
🤖 Prompt for AI Agents
In test/functional/feature_masternode_params.py around lines 75-77, the test
opens node1.debug_log_path as if it were an attribute but debug_log_path is a
method; call node1.debug_log_path() when opening the file. Replace uses of
node1.debug_log_path with node1.debug_log_path() and keep the existing
assertion. Optionally, add an earlier check (before the explicit-disable
restart) asserting that the log contains "parameter interaction:
-masternodeblsprivkey set -> setting -peerblockfilters=1" and "parameter
interaction: -masternodeblsprivkey set -> setting -blockfilterindex=basic" to
validate auto-enable behavior.

@knst knst self-requested a review August 12, 2025 14:40


if __name__ == '__main__':
MasternodeParamsTest().main() No newline at end of file
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: missing \n


# Should not have blockfilterindex
index_info = node1.getindexinfo()
assert 'basic filter index' not in index_info
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: this string is re-used multiple times; consider to define a const


self.log.info("Test that masternode parameter interaction is logged")
# Check debug log for parameter interaction messages
with open(node1.debug_log_path, 'r') as f:
Copy link
Collaborator

@knst knst Aug 13, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

consider using here a helper assert_debug_log instead of manual reading of logs.

See test/functional/p2p_blocksonly.py or test/functional/rpc_net.py for an example (it's not exhausting list of functional tests that uses this helper)

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

♻️ Duplicate comments (4)
test/functional/feature_masternode_params.py (4)

41-41: Masternode start may fail without -txindex=1; add required args

Dash masternodes typically require -txindex=1 to start. Include it (keep -peerbloomfilters=1 explicit if you want cross-branch stability).

-        self.restart_node(1, extra_args=[f"-masternodeblsprivkey={bls_key}"])
+        self.restart_node(1, extra_args=[
+            f"-masternodeblsprivkey={bls_key}",
+            "-txindex=1",
+            "-peerbloomfilters=1",
+        ])

44-51: Assert behavior, don’t just log: verify service bit and index for masternode

Turn the logs into assertions so the test enforces the intended behavior.

         # Masternode should have peerblockfilters enabled
         services = int(node1.getnetworkinfo()['localservices'], 16)
-        self.log.info(f"Masternode services: {hex(services)}, has COMPACT_FILTERS: {services & NODE_COMPACT_FILTERS != 0}")
+        self.log.info(f"Masternode services: {hex(services)}, has COMPACT_FILTERS: {services & NODE_COMPACT_FILTERS != 0}")
+        assert services & NODE_COMPACT_FILTERS != 0
         
         # Check blockfilterindex
         index_info = node1.getindexinfo()
-        self.log.info(f"Masternode indexes: {list(index_info.keys())}")
+        self.log.info(f"Masternode indexes: {list(index_info.keys())}")
+        assert any(('filter' in k and 'basic' in k) for k in index_info.keys())

75-77: Fix debug log path usage (method vs attribute)

debug_log_path is a method in the framework. Call it.

-        with open(node1.debug_log_path, 'r', encoding='utf-8') as f:
+        with open(node1.debug_log_path(), 'r', encoding='utf-8') as f:
             log_content = f.read()
             assert "parameter interaction: -masternodeblsprivkey set -> setting -disablewallet=1" in log_content

58-63: Include -txindex=1 for the explicit-disable masternode restart as well

Maintain masternode requirements across restarts. Without -txindex=1, startup may fail.

         self.restart_node(1, extra_args=[
             f"-masternodeblsprivkey={bls_key}",
+            "-txindex=1",
             "-peerblockfilters=0",
             "-blockfilterindex=0"
         ])
🧹 Nitpick comments (4)
test/functional/feature_masternode_params.py (4)

52-55: Remove redundant liveness check

Once you assert the service bit and index, the extra "node is running" check is redundant.

-        # For now, just check that the node started successfully with masternode key
-        # The actual filter enabling might require the node to be fully synced
-        assert node1.getblockcount() >= 0  # Basic check that node is running
+        # Node started successfully and exposes compact filter services and index

69-72: Make block filter index checks robust and correct the key

"basic filter index" is likely not the exact key. Prefer a robust presence check based on substrings.

         # Should not have blockfilterindex
         index_info = node1.getindexinfo()
-        assert 'basic filter index' not in index_info
+        assert not any(('filter' in k and 'basic' in k) for k in index_info.keys())

73-80: Prefer using the built-in assert_debug_log helper

The framework provides a helper to assert log content without manual file IO. It’s cleaner and less brittle. See examples in test/functional/p2p_blocksonly.py or rpc_net.py.

Example:

with node1.assert_debug_log(["parameter interaction: -masternodeblsprivkey set -> setting -disablewallet=1"]):
    pass

82-83: Add trailing newline at EOF

Minor formatting nit to satisfy some tooling.

-    MasternodeParamsTest().main()
+    MasternodeParamsTest().main()
+
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

💡 Knowledge Base configuration:

  • MCP integration is disabled by default for public repositories
  • Jira integration is disabled by default for public repositories
  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between 2fabaa9 and 4e33c24.

📒 Files selected for processing (1)
  • test/functional/feature_masternode_params.py (1 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
test/functional/**/*.py

📄 CodeRabbit Inference Engine (CLAUDE.md)

Functional tests should be written in Python and placed in test/functional/

Files:

  • test/functional/feature_masternode_params.py
🧠 Learnings (2)
📚 Learning: 2025-06-09T16:43:20.996Z
Learnt from: kwvg
PR: dashpay/dash#6718
File: test/functional/test_framework/test_framework.py:2102-2102
Timestamp: 2025-06-09T16:43:20.996Z
Learning: In the test framework consolidation PR (#6718), user kwvg prefers to limit functional changes to those directly related to MasternodeInfo, avoiding scope creep even for minor improvements like error handling consistency.

Applied to files:

  • test/functional/feature_masternode_params.py
📚 Learning: 2025-08-10T13:52:46.289Z
Learnt from: kwvg
PR: dashpay/dash#6666
File: test/functional/rpc_netinfo.py:73-81
Timestamp: 2025-08-10T13:52:46.289Z
Learning: In the Bitcoin/Dash test framework, `self.node.extra_args` contains the original startup arguments for a TestNode and is not modified by `test.restart_node()`. Each restart with new `extra_args` doesn't update the stored `self.node.extra_args`, so copying from it always provides a clean slate without accumulated modifications from previous restarts.

Applied to files:

  • test/functional/feature_masternode_params.py
🧬 Code Graph Analysis (1)
test/functional/feature_masternode_params.py (2)
test/functional/test_framework/util.py (1)
  • assert_equal (69-74)
test/functional/test_framework/test_node.py (1)
  • debug_log_path (432-433)
🪛 Ruff (0.12.2)
test/functional/feature_masternode_params.py

12-12: test_framework.util.assert_equal imported but unused

Remove unused import: test_framework.util.assert_equal

(F401)

🪛 Flake8 (7.2.0)
test/functional/feature_masternode_params.py

[error] 12-12: 'test_framework.util.assert_equal' imported but unused

(F401)

⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (7)
  • GitHub Check: Lint / Run linters
  • GitHub Check: x86_64-apple-darwin / Build depends
  • GitHub Check: x86_64-w64-mingw32 / Build depends
  • GitHub Check: x86_64-pc-linux-gnu_nowallet / Build depends
  • GitHub Check: x86_64-pc-linux-gnu_multiprocess / Build depends
  • GitHub Check: x86_64-pc-linux-gnu / Build depends
  • GitHub Check: arm-linux-gnueabihf / Build depends
🔇 Additional comments (1)
test/functional/feature_masternode_params.py (1)

27-34: Incorrect — regular-node defaults remain disabled; do not invert the assertions

init.cpp only auto-enables -peerblockfilters / -blockfilterindex when a masternode key is set (src/init.cpp:1027-1031, 1152-1177). The man page and release notes show the defaults are 0 (disabled) for regular nodes (doc/man/dashd.1 and doc/release-notes-6711.md). The test assertions at test/functional/feature_masternode_params.py:27-34 (checking peerblockfilters and blockfilterindex are disabled for a regular node) are therefore correct — the proposed inversion is incorrect. Ignore the suggested diff.

Files/locations:

  • test/functional/feature_masternode_params.py:27-34 — current assertions check disabled by default (keep as-is).
  • src/init.cpp:1027-1031 and 1152-1177 — masternode auto-enable logic and NODE_COMPACT_FILTERS gating.
  • doc/man/dashd.1 (defaults: 0) and doc/release-notes-6711.md — confirm regular nodes keep previous disabled defaults.

Optional suggestion: normalize the index-name check (the repo uses "basic block filter index" elsewhere, e.g. test/functional/rpc_misc.py) — use a substring-based or canonicalized key check for robustness.

Likely an incorrect or invalid review comment.

- Add constant for 'basic filter index' string to avoid repetition
- Use assert_debug_log helper instead of manual log file reading
- Add missing newline at end of file

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <[email protected]>
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 0

♻️ Duplicate comments (5)
test/functional/feature_masternode_params.py (5)

81-88: Use assert_debug_log helper consistently and add missing auto-enable checks.

The test uses assert_debug_log for one interaction but manually reads logs elsewhere. For consistency and completeness, add checks for the auto-enable log messages.

-        # Check debug log for parameter interaction messages during startup
-        with self.nodes[1].assert_debug_log(["parameter interaction: -masternodeblsprivkey set -> setting -disablewallet=1"]):
+        # Check debug log for parameter interaction messages during startup
+        with self.nodes[1].assert_debug_log([
+            "parameter interaction: -masternodeblsprivkey set -> setting -disablewallet=1",
+            "parameter interaction: -masternodeblsprivkey set -> setting -peerblockfilters=1",
+            "parameter interaction: -masternodeblsprivkey set -> setting -blockfilterindex=basic"
+        ]):
             self.start_node(1, extra_args=[
-                f"-masternodeblsprivkey={bls_key}",
-                "-peerblockfilters=0",
-                "-blockfilterindex=0"
+                f"-masternodeblsprivkey={bls_key}",
+                "-txindex=1"
             ])
-        # Note: The peerblockfilters and blockfilterindex messages won't be in the log
-        # when explicitly disabled, only when auto-enabled

90-90: Add missing newline at end of file.

The file should end with a newline character.

 
+
 if __name__ == '__main__':
     MasternodeParamsTest().main()
+

12-12: Remove unused import.

The assert_equal import is not used in the test and triggers linter errors.

-from test_framework.util import assert_equal

44-44: Add required masternode arguments to prevent startup failure.

Based on the PR objectives and past review feedback, masternodes require -txindex=1 to start successfully. The current restart will likely fail without this argument.

-        self.restart_node(1, extra_args=[f"-masternodeblsprivkey={bls_key}"])
+        self.restart_node(1, extra_args=[
+            f"-masternodeblsprivkey={bls_key}",
+            "-txindex=1",
+        ])

47-57: Add proper assertions for auto-enabled block filters.

The test should verify that the masternode actually has the expected service flags and block filter index, not just log values and perform a basic liveness check.

-        # Masternode should have peerblockfilters enabled
-        services = int(node1.getnetworkinfo()['localservices'], 16)
-        self.log.info(f"Masternode services: {hex(services)}, has COMPACT_FILTERS: {services & NODE_COMPACT_FILTERS != 0}")
-
-        # Check blockfilterindex
-        index_info = node1.getindexinfo()
-        self.log.info(f"Masternode indexes: {list(index_info.keys())}")
-
-        # For now, just check that the node started successfully with masternode key
-        # The actual filter enabling might require the node to be fully synced
-        assert node1.getblockcount() >= 0  # Basic check that node is running
+        # Masternode should have peerblockfilters enabled
+        services = int(node1.getnetworkinfo()['localservices'], 16)
+        self.log.info(f"Masternode services: {hex(services)}, has COMPACT_FILTERS: {services & NODE_COMPACT_FILTERS != 0}")
+        assert services & NODE_COMPACT_FILTERS != 0
+
+        # Check that a basic block filter index exists
+        index_info = node1.getindexinfo()
+        self.log.info(f"Masternode indexes: {list(index_info.keys())}")
+        assert BASIC_FILTER_INDEX in index_info
🧹 Nitpick comments (1)
test/functional/feature_masternode_params.py (1)

61-65: Include txindex in explicit disable test.

For consistency with the earlier masternode restart, include -txindex=1 in the explicit disable test to ensure the masternode starts properly.

         self.restart_node(1, extra_args=[
             f"-masternodeblsprivkey={bls_key}",
+            "-txindex=1",
             "-peerblockfilters=0",
             "-blockfilterindex=0"
         ])
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

💡 Knowledge Base configuration:

  • MCP integration is disabled by default for public repositories
  • Jira integration is disabled by default for public repositories
  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between 4e33c24 and cec4ae0.

📒 Files selected for processing (1)
  • test/functional/feature_masternode_params.py (1 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
test/functional/**/*.py

📄 CodeRabbit Inference Engine (CLAUDE.md)

Functional tests should be written in Python and placed in test/functional/

Files:

  • test/functional/feature_masternode_params.py
🧠 Learnings (2)
📚 Learning: 2025-06-09T16:43:20.996Z
Learnt from: kwvg
PR: dashpay/dash#6718
File: test/functional/test_framework/test_framework.py:2102-2102
Timestamp: 2025-06-09T16:43:20.996Z
Learning: In the test framework consolidation PR (#6718), user kwvg prefers to limit functional changes to those directly related to MasternodeInfo, avoiding scope creep even for minor improvements like error handling consistency.

Applied to files:

  • test/functional/feature_masternode_params.py
📚 Learning: 2025-08-10T13:52:46.289Z
Learnt from: kwvg
PR: dashpay/dash#6666
File: test/functional/rpc_netinfo.py:73-81
Timestamp: 2025-08-10T13:52:46.289Z
Learning: In the Bitcoin/Dash test framework, `self.node.extra_args` contains the original startup arguments for a TestNode and is not modified by `test.restart_node()`. Each restart with new `extra_args` doesn't update the stored `self.node.extra_args`, so copying from it always provides a clean slate without accumulated modifications from previous restarts.

Applied to files:

  • test/functional/feature_masternode_params.py
🧬 Code Graph Analysis (1)
test/functional/feature_masternode_params.py (4)
test/functional/test_framework/test_framework.py (1)
  • start_node (639-648)
test/functional/test_framework/util.py (1)
  • assert_equal (69-74)
src/bls/bls.h (1)
  • bls (31-33)
test/functional/test_framework/test_node.py (1)
  • assert_debug_log (441-469)
🪛 Ruff (0.12.2)
test/functional/feature_masternode_params.py

12-12: test_framework.util.assert_equal imported but unused

Remove unused import: test_framework.util.assert_equal

(F401)

🪛 Flake8 (7.2.0)
test/functional/feature_masternode_params.py

[error] 12-12: 'test_framework.util.assert_equal' imported but unused

(F401)

⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
  • GitHub Check: Build container / Build container
  • GitHub Check: predict_conflicts

Mention that BIP157 block filters require approximately 1GB+ of
additional disk space, as suggested in code review.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <[email protected]>
@UdjinM6
Copy link

UdjinM6 commented Aug 15, 2025

linter complains test/functional/feature_masternode_params.py:12:1: F401 'test_framework.util.assert_equal' imported but unused

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

♻️ Duplicate comments (1)
doc/release-notes-6711.md (1)

7-7: Good call-out on disk usage; prior feedback addressed.

You’ve added the 1GB+ disk space note, which resolves the earlier reviewer’s concern.

🧹 Nitpick comments (2)
doc/release-notes-6711.md (2)

6-7: Minor editorial nit: spacing and sentence flow.

  • There appears to be an extra space before “Note” (double space after the previous sentence). Remove it for consistency.
  • Optional: split the long paragraph into two sentences (ending after “are automatically enabled.”) to improve readability.

9-9: Style nit: punctuation around PR reference.

Consider either removing the parentheses or adding a comma before “if needed,” and placing the PR number at the end without parentheses for consistency with other release notes (if applicable to this repo).

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

💡 Knowledge Base configuration:

  • MCP integration is disabled by default for public repositories
  • Jira integration is disabled by default for public repositories
  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between cec4ae0 and fcd1b8c.

📒 Files selected for processing (1)
  • doc/release-notes-6711.md (1 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
doc/**

📄 CodeRabbit Inference Engine (CLAUDE.md)

Unless specifically prompted, avoid making changes to the doc directory (documentation)

Files:

  • doc/release-notes-6711.md
🪛 LanguageTool
doc/release-notes-6711.md

[grammar] ~6-~6: There might be a mistake here.
Context: ...rindex=basic` are automatically enabled. Note that this feature requires approx...

(QB_NEW_EN)


[grammar] ~9-~9: There might be a mistake here.
Context: ...ers=0or-blockfilterindex=0` (#6711).

(QB_NEW_EN)

⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (4)
  • GitHub Check: x86_64-w64-mingw32 / Build depends
  • GitHub Check: x86_64-apple-darwin / Build depends
  • GitHub Check: Lint / Run linters
  • GitHub Check: x86_64-pc-linux-gnu_nowallet / Build depends

@PastaPastaPasta PastaPastaPasta changed the title feat: enable bip157 filters by default feat: auto-enable BIP157 block filters for masternodes only Aug 15, 2025
Remove unused assert_equal import to fix linter warning.

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <[email protected]>
@UdjinM6
Copy link

UdjinM6 commented Aug 15, 2025

tests failed with WARNING! The following scripts are not being run: ['feature_masternode_params.py']. Check the test lists in test_runner.py.

Copy link

@UdjinM6 UdjinM6 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

utACK 2b17480

Copy link
Collaborator

@knst knst left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM 2b17480

@PastaPastaPasta PastaPastaPasta merged commit a93d2bf into dashpay:develop Aug 20, 2025
33 of 35 checks passed
knst pushed a commit to knst/dash that referenced this pull request Sep 18, 2025
…nodes only

2b17480 fix(tests): add feature_masternode_params.py to test runner (pasta)
bcff97a test: remove unused import from feature_masternode_params (pasta)
fcd1b8c doc: add disk space requirement note to release notes (pasta)
cec4ae0 test: address code review feedback for feature_masternode_params (pasta)
4e33c24 fix: specify utf8 (pasta)
ac5c499 chore: trailing whitespace (pasta)
2fabaa9 fix: Address code review feedback for masternode-only BIP157 (pasta)
90ef2d5 refactor: Enable BIP157 block filters only for masternodes (pasta)
d40ae45 test: fix tests incompatible with default peerblockfilters=1 (pasta)
d6c11f0 test: fix feature_index_prune.py for new peerblockfilters default (pasta)
2a88db9 test: Fix feature_index_prune.py to explicitly disable indices (pasta)
4412ced test: Fix feature_index_prune.py to work with new blockfilterindex defaults (pasta)
e6e9ff8 test: Fix functional tests to work with new blockfilterindex defaults (pasta)
ef2a1e3 Fix initialization error when using default blockfilterindex value (pasta)
fbde721 docs: Fix PR number in release notes - rename to 6711 (pasta)
0274cd2 docs: Add release notes for PR dashpay#6708 (pasta)
ac7e03e Enable BIP157 block filters index and serving by default (pasta)

Pull request description:

  ## Issue being fixed or feature implemented
  This pull request introduces automatic enabling of BIP157 compact block filters specifically for masternodes to improve privacy and functionality for light clients connecting to them. Regular nodes retain the existing default settings.

  ## What was done?
  - **Automatic Enablement for Masternodes**: When a node is configured as a masternode (via `-masternodeblsprivkey`), both `-peerblockfilters` and `-blockfilterindex=basic` are now automatically enabled.
  - **Regular Nodes Unchanged**: Regular (non-masternode) nodes keep the previous defaults with both options disabled (`-peerblockfilters=false` and `-blockfilterindex=0`).
  - **Opt-out Available**: Masternodes can still explicitly disable these features if needed by setting `-peerblockfilters=0` or `-blockfilterindex=0`.
  - **Release Notes**: Updated to clearly document this masternode-specific behavior and the ~1GB disk space requirement for the block filter index.
  - **Tests**: Added functional test to verify the parameter interactions and that the settings are correctly applied only to masternodes.

  ## How Has This Been Tested?
  - Built locally
  - Added new functional test `feature_masternode_params.py` that verifies:
    - Regular nodes have filters disabled by default
    - Masternodes have filters auto-enabled
    - Masternodes can explicitly disable filters
    - Parameter interaction logging works correctly

  ## Breaking Changes
  None - this only affects masternodes and they can opt out if needed.

  ## Checklist:
    _Go over all the following points, and put an `x` in all the boxes that apply._
  - [x] I have performed a self-review of my own code
  - [ ] I have commented my code, particularly in hard-to-understand areas
  - [x] I have added or updated relevant unit/integration/functional/e2e tests
  - [x] I have made corresponding changes to the documentation
  - [x] I have assigned this pull request to a milestone _(for repository code-owners and collaborators only)_

ACKs for top commit:
  UdjinM6:
    utACK 2b17480

Tree-SHA512: 6a11305cf54c7584de4ca8dbe520e022e23f211ec6b0e2ee7679073f75a465ead927814f3f01f77e8576f96a187167511204d1906d380937f98310948933dc83
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants