refactor: split p2p_getdata.py in sub-cases
What changed, and why it matters
This commit is a simple code cleanup in a test file. It takes an existing test and moves it into a separate helper method, then calls that method from the main test runner. There is no change to Bitcoin Core's actual network code, no bug fix, and no security-related behavior change.
No action needed; this is a non-functional test refactor.
Security signals we found
No strong security signals were identified.
Evidence from the diff
The diff refactors test/functional/p2p_getdata.py by renaming run_test() to test_invalid_getdata() and adding a new run_test() that calls test_invalid_getdata(). The test logic, including the invalid GETDATA handling and future-message processing assertions, is unchanged. This is purely a structural/test-organizational refactor.
Changed components
test/functional/p2p_getdata.pyInspect captured patch +5 / −1
diff --git a/test/functional/p2p_getdata.py b/test/functional/p2p_getdata.py
index 7a816ae6..5ff35060 100755
--- a/test/functional/p2p_getdata.py
+++ b/test/functional/p2p_getdata.py
@@ -26,7 +26,7 @@ class GetdataTest(BitcoinTestFramework):
def set_test_params(self):
self.num_nodes = 1
- def run_test(self):
+ def test_invalid_getdata(self):
p2p_block_store = self.nodes[0].add_p2p_connection(P2PStoreBlock())
self.log.info("test that an invalid GETDATA doesn't prevent processing of future messages")
@@ -44,5 +44,9 @@ class GetdataTest(BitcoinTestFramework):
p2p_block_store.wait_until(lambda: p2p_block_store.blocks[best_block] == 1)
+ def run_test(self):
+ self.test_invalid_getdata()
+
+
if __name__ == '__main__':
GetdataTest(__file__).main()
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.