Skip to content

Commit cec4ae0

Browse files
test: address code review feedback for feature_masternode_params
- 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]>
1 parent 4e33c24 commit cec4ae0

File tree

1 file changed

+18
-9
lines changed

1 file changed

+18
-9
lines changed

test/functional/feature_masternode_params.py

Lines changed: 18 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,9 @@
1414
# Service flags
1515
NODE_COMPACT_FILTERS = (1 << 6)
1616

17+
# Constants
18+
BASIC_FILTER_INDEX = 'basic filter index'
19+
1720

1821
class MasternodeParamsTest(BitcoinTestFramework):
1922
def set_test_params(self):
@@ -30,7 +33,7 @@ def run_test(self):
3033

3134
# Regular node should not have blockfilterindex enabled
3235
index_info = node0.getindexinfo()
33-
assert 'basic filter index' not in index_info
36+
assert BASIC_FILTER_INDEX not in index_info
3437

3538
self.log.info("Test that masternode has blockfilters auto-enabled")
3639
# Generate a valid BLS key for testing
@@ -68,16 +71,22 @@ def run_test(self):
6871

6972
# Should not have blockfilterindex
7073
index_info = node1.getindexinfo()
71-
assert 'basic filter index' not in index_info
74+
assert BASIC_FILTER_INDEX not in index_info
7275

7376
self.log.info("Test that masternode parameter interaction is logged")
74-
# Check debug log for parameter interaction messages
75-
with open(node1.debug_log_path, 'r', encoding='utf-8') as f:
76-
log_content = f.read()
77-
assert "parameter interaction: -masternodeblsprivkey set -> setting -disablewallet=1" in log_content
78-
# Note: The peerblockfilters and blockfilterindex messages won't be in the log
79-
# when explicitly disabled, only when auto-enabled
77+
# Stop the node first so we can check the startup logs
78+
self.stop_node(1)
79+
80+
# Check debug log for parameter interaction messages during startup
81+
with self.nodes[1].assert_debug_log(["parameter interaction: -masternodeblsprivkey set -> setting -disablewallet=1"]):
82+
self.start_node(1, extra_args=[
83+
f"-masternodeblsprivkey={bls_key}",
84+
"-peerblockfilters=0",
85+
"-blockfilterindex=0"
86+
])
87+
# Note: The peerblockfilters and blockfilterindex messages won't be in the log
88+
# when explicitly disabled, only when auto-enabled
8089

8190

8291
if __name__ == '__main__':
83-
MasternodeParamsTest().main()
92+
MasternodeParamsTest().main()

0 commit comments

Comments
 (0)