What changed, and why it matters
This is a tiny code cleanup in a Bitcoin Core test file. It replaces the hard-coded number 3 with the actual number of test nodes, making the test slightly easier to maintain. It does not change any real Bitcoin Core software behavior and has no security relevance.
No action needed. This is a benign test refactoring.
Security signals we found
No strong security signals were identified.
Evidence from the diff
The commit modifies test/functional/wallet_basic.py to replace three list comprehensions that used range(3) with iterations over self.nodes directly, and replaces a literal [block_count] * 3 with [block_count] * len(self.nodes). This is a refactoring-only change in functional tests; no node logic, consensus code, wallet logic, or network behavior is affected.
Changed components
test/functional/wallet_basic.pyInspect captured patch +3 / −3
### test/functional/wallet_basic.py
@@ -437,7 +437,7 @@ def run_test(self):
# check if wallet or blockchain maintenance changes the balance
self.sync_all()
blocks = self.generate(self.nodes[0], 2)
- balance_nodes = [self.nodes[i].getbalance() for i in range(3)]
+ balance_nodes = [node.getbalance() for node in self.nodes]
block_count = self.nodes[0].getblockcount()
# Check modes:
@@ -462,8 +462,8 @@ def run_test(self):
self.start_node(1, ['-reindex', "-limitclustercount=" + str(chainlimit)])
self.start_node(2, ['-reindex', "-limitclustercount=" + str(chainlimit)])
# reindex will leave rpc warm up "early"; Wait for it to finish
- self.wait_until(lambda: [block_count] * 3 == [self.nodes[i].getblockcount() for i in range(3)])
- assert_equal(balance_nodes, [self.nodes[i].getbalance() for i in range(3)])
+ self.wait_until(lambda: [block_count] * len(self.nodes) == [node.getblockcount() for node in self.nodes])
+ assert_equal(balance_nodes, [node.getbalance() for node in self.nodes])
# Exercise listsinceblock with the last two blocks
coinbase_tx_1 = self.nodes[0].listsinceblock(blocks[0])Why this scored 15/100
Community notes
Notes can correct, qualify, or add evidence to the AI analysis. Every note shown here has been validated by a human moderator.
The AI analysis stands alone for now. Submit a note if you can add evidence or important context.