mirror of
https://github.com/bitcoin/bitcoin.git
synced 2024-11-20 02:25:40 +01:00
Merge bitcoin/bitcoin#27784: test: fix intermittent error in getblockfrompeer.py
9fe9074266
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 https://github.com/bitcoin/bitcoin/issues/27749#issuecomment-1566354933 and https://github.com/bitcoin/bitcoin/issues/27749#issuecomment-1566554075 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 ACK9fe9074266
theStack: ACK9fe9074266
Tree-SHA512: f3de1ea68725429aeef448c351ea812b805fa216912b112d7db9aceeddb1f2381b705c2577734b0d308e78ec5e0c4d26dc65fc2171f6e21f13061fc71d48216c
This commit is contained in:
commit
433f17bc3f
@ -117,9 +117,11 @@ class GetBlockFromPeerTest(BitcoinTestFramework):
|
||||
assert_raises_rpc_error(-1, error_msg, self.nodes[1].getblockfrompeer, blockhash, node1_interface_id)
|
||||
|
||||
self.log.info("Connect pruned node")
|
||||
# We need to generate more blocks to be able to prune
|
||||
self.connect_nodes(0, 2)
|
||||
pruned_node = self.nodes[2]
|
||||
self.sync_blocks([self.nodes[0], pruned_node])
|
||||
|
||||
# We need to generate more blocks to be able to prune
|
||||
self.generate(self.nodes[0], 400, sync_fun=self.no_op)
|
||||
self.sync_blocks([self.nodes[0], pruned_node])
|
||||
pruneheight = pruned_node.pruneblockchain(300)
|
||||
|
Loading…
Reference in New Issue
Block a user