Skip to content

Commit 9fe9074

Browse files
committed
test: add block sync to getblockfrompeer.py
This fixes an intermittent error, caused by blocks arriving out of order due to how compact block relay may revert to headers processing when the tip hasn't caught up, and resulting in slightly different pruning behavior. Making sure that all blocks from the previous tests are synced before generating more blocks makes this impossible. See Issue #27749 for more details.
1 parent 7130048 commit 9fe9074

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

test/functional/rpc_getblockfrompeer.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,9 +117,11 @@ def run_test(self):
117117
assert_raises_rpc_error(-1, error_msg, self.nodes[1].getblockfrompeer, blockhash, node1_interface_id)
118118

119119
self.log.info("Connect pruned node")
120-
# We need to generate more blocks to be able to prune
121120
self.connect_nodes(0, 2)
122121
pruned_node = self.nodes[2]
122+
self.sync_blocks([self.nodes[0], pruned_node])
123+
124+
# We need to generate more blocks to be able to prune
123125
self.generate(self.nodes[0], 400, sync_fun=self.no_op)
124126
self.sync_blocks([self.nodes[0], pruned_node])
125127
pruneheight = pruned_node.pruneblockchain(300)

0 commit comments

Comments
 (0)