Skip to content

Commit 433f17b

Browse files
committed
Merge bitcoin/bitcoin#27784: test: fix intermittent error in getblockfrompeer.py
9fe9074 test: add block sync to getblockfrompeer.py (Martin Zumsande) Pull request description: This adds an additional `sync_blocks` call, fixing 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 bitcoin/bitcoin#27749 (comment) and bitcoin/bitcoin#27749 (comment) for a more detailed analysis. #27770 is a more long-term approach to avoid having to deal with magic pruneheight numbers in the first place, but that PR introduces a new RPC and needs more discussion. Fixes #27749. ACKs for top commit: MarcoFalke: lgtm ACK 9fe9074 theStack: ACK 9fe9074 Tree-SHA512: f3de1ea68725429aeef448c351ea812b805fa216912b112d7db9aceeddb1f2381b705c2577734b0d308e78ec5e0c4d26dc65fc2171f6e21f13061fc71d48216c
2 parents 08722f2 + 9fe9074 commit 433f17b

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)