Changeset View
Changeset View
Standalone View
Standalone View
qa/rpc-tests/pruning.py
Show First 20 Lines • Show All 238 Lines • ▼ Show 20 Lines | def reorg_test(self): | ||||
raise AssertionError("Pruning target not being met") | raise AssertionError("Pruning target not being met") | ||||
return invalidheight, badhash | return invalidheight, badhash | ||||
def reorg_back(self): | 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_jsonrpc( | assert_raises_jsonrpc( | ||||
-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("Will need to redownload block", self.forkheight) | self.log.info("Will need to redownload block %d" % 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 block are in | ||||
# the block files after it, its expected to still be retained. | # the block files after it, its 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() | ||||
▲ Show 20 Lines • Show All 277 Lines • Show Last 20 Lines |