Changeset View
Changeset View
Standalone View
Standalone View
test/functional/feature_pruning.py
Show First 20 Lines • Show All 153 Lines • ▼ Show 20 Lines | def reorg_test(self): | ||||
# 0 and Node 2's tip. This will cause Node 2 to do a reorg requiring | # 0 and Node 2's tip. This will cause Node 2 to do a reorg requiring | ||||
# 288 blocks of undo data to the reorg_test chain. Reboot node 1 to | # 288 blocks of undo data to the reorg_test chain. Reboot node 1 to | ||||
# clear its mempool (hopefully make the invalidate faster). Lower the | # clear its mempool (hopefully make the invalidate faster). Lower the | ||||
# block max size so we don't keep mining all our big mempool | # block max size so we don't keep mining all our big mempool | ||||
# transactions (from disconnected blocks) | # transactions (from disconnected blocks) | ||||
self.stop_node(1) | self.stop_node(1) | ||||
self.start_node(1, extra_args=[ | self.start_node(1, extra_args=[ | ||||
"-maxreceivebuffer=20000", "-blockmaxsize=5000", "-checkblocks=5", | "-maxreceivebuffer=20000", "-blockmaxsize=5000", "-checkblocks=5", | ||||
"-disablesafemode", "-noparkdeepreorg", "-maxreorgdepth=-1"]) | "-noparkdeepreorg", "-maxreorgdepth=-1"]) | ||||
height = self.nodes[1].getblockcount() | height = self.nodes[1].getblockcount() | ||||
self.log.info("Current block height: {}".format(height)) | self.log.info("Current block height: {}".format(height)) | ||||
invalidheight = height - 287 | invalidheight = height - 287 | ||||
badhash = self.nodes[1].getblockhash(invalidheight) | badhash = self.nodes[1].getblockhash(invalidheight) | ||||
self.log.info("Invalidating block {} at height {}".format( | self.log.info("Invalidating block {} at height {}".format( | ||||
badhash, invalidheight)) | badhash, invalidheight)) | ||||
Show All 11 Lines | def reorg_test(self): | ||||
assert(self.nodes[1].getblockcount() == invalidheight - 1) | assert(self.nodes[1].getblockcount() == invalidheight - 1) | ||||
self.log.info("New best height: {}".format( | self.log.info("New best height: {}".format( | ||||
self.nodes[1].getblockcount())) | self.nodes[1].getblockcount())) | ||||
# Reboot node1 to clear those giant tx's from mempool | # Reboot node1 to clear those giant tx's from mempool | ||||
self.stop_node(1) | self.stop_node(1) | ||||
self.start_node(1, extra_args=[ | self.start_node(1, extra_args=[ | ||||
"-maxreceivebuffer=20000", "-blockmaxsize=5000", "-checkblocks=5", | "-maxreceivebuffer=20000", "-blockmaxsize=5000", "-checkblocks=5", | ||||
"-disablesafemode", "-noparkdeepreorg", "-maxreorgdepth=-1"]) | "-noparkdeepreorg", "-maxreorgdepth=-1"]) | ||||
self.log.info("Generating new longer chain of 300 more blocks") | self.log.info("Generating new longer chain of 300 more blocks") | ||||
self.nodes[1].generate(300) | self.nodes[1].generate(300) | ||||
self.log.info("Reconnect nodes") | self.log.info("Reconnect nodes") | ||||
connect_nodes(self.nodes[0], self.nodes[1]) | connect_nodes(self.nodes[0], self.nodes[1]) | ||||
connect_nodes(self.nodes[2], self.nodes[1]) | connect_nodes(self.nodes[2], self.nodes[1]) | ||||
sync_blocks(self.nodes[0:3], timeout=120) | sync_blocks(self.nodes[0:3], timeout=120) | ||||
▲ Show 20 Lines • Show All 326 Lines • Show Last 20 Lines |