Changeset View
Changeset View
Standalone View
Standalone View
test/functional/feature_pruning.py
Show First 20 Lines • Show All 225 Lines • ▼ Show 20 Lines | def reorg_back(self): | ||||
# Verify that a block on the old main chain fork has been pruned away | # Verify that a block on the old main chain fork has been pruned away | ||||
assert_raises_rpc_error( | assert_raises_rpc_error( | ||||
-1, "Block not available (pruned data)", self.nodes[2].getblock, self.forkhash) | -1, "Block not available (pruned data)", self.nodes[2].getblock, self.forkhash) | ||||
self.log.info( | self.log.info( | ||||
"Will need to redownload block {}".format(self.forkheight)) | "Will need to redownload block {}".format(self.forkheight)) | ||||
# Verify that we have enough history to reorg back to the fork point. | # Verify that we have enough history to reorg back to the fork point. | ||||
# Although this is more than 288 blocks, because this chain was written | # Although this is more than 288 blocks, because this chain was written | ||||
# more recently and only its other 299 small and 220 large block are in | # more recently and only its other 299 small and 220 large blocks are in | ||||
# the block files after it, its expected to still be retained. | # the block files after it, it is expected to still be retained. | ||||
self.nodes[2].getblock(self.nodes[2].getblockhash(self.forkheight)) | self.nodes[2].getblock(self.nodes[2].getblockhash(self.forkheight)) | ||||
first_reorg_height = self.nodes[2].getblockcount() | first_reorg_height = self.nodes[2].getblockcount() | ||||
curchainhash = self.nodes[2].getblockhash(self.mainchainheight) | curchainhash = self.nodes[2].getblockhash(self.mainchainheight) | ||||
self.nodes[2].invalidateblock(curchainhash) | self.nodes[2].invalidateblock(curchainhash) | ||||
goalbestheight = self.mainchainheight | goalbestheight = self.mainchainheight | ||||
goalbesthash = self.mainchainhash2 | goalbesthash = self.mainchainhash2 | ||||
▲ Show 20 Lines • Show All 280 Lines • Show Last 20 Lines |