Changeset View
Changeset View
Standalone View
Standalone View
test/functional/abc-minimaldata-activation.py
Show First 20 Lines • Show All 231 Lines • ▼ Show 20 Lines | def run_test(self): | ||||
blocks = [] | blocks = [] | ||||
for i in range(-1, 5): | for i in range(-1, 5): | ||||
tip = self.build_block(tip, nTime=GRAVITON_START_TIME + i) | tip = self.build_block(tip, nTime=GRAVITON_START_TIME + i) | ||||
blocks.append(tip) | blocks.append(tip) | ||||
node.p2p.send_blocks_and_test(blocks, node) | node.p2p.send_blocks_and_test(blocks, node) | ||||
assert_equal(node.getblockchaininfo()[ | assert_equal(node.getblockchaininfo()[ | ||||
'mediantime'], GRAVITON_START_TIME - 1) | 'mediantime'], GRAVITON_START_TIME - 1) | ||||
# save this tip for later | |||||
preupgrade_block = tip | |||||
self.log.info( | self.log.info( | ||||
"Mine the activation block itself, including a minimaldata violation at the last possible moment") | "Mine the activation block itself, including a minimaldata violation at the last possible moment") | ||||
tip = self.build_block(tip, [nonminimaltx_2]) | tip = self.build_block(tip, [nonminimaltx_2]) | ||||
node.p2p.send_blocks_and_test([tip], node) | node.p2p.send_blocks_and_test([tip], node) | ||||
self.log.info("We have activated!") | self.log.info("We have activated!") | ||||
assert_equal(node.getblockchaininfo()[ | assert_equal(node.getblockchaininfo()[ | ||||
'mediantime'], GRAVITON_START_TIME) | 'mediantime'], GRAVITON_START_TIME) | ||||
# save this tip for later | |||||
upgrade_block = tip | |||||
self.log.info( | self.log.info( | ||||
"Trying to mine a minimaldata violation, but we are just barely too late") | "Trying to mine a minimaldata violation, but we are just barely too late") | ||||
self.check_for_ban_on_rejected_block( | self.check_for_ban_on_rejected_block( | ||||
self.build_block(tip, [nonminimaltx_3]), **BADINPUTS_ERROR) | self.build_block(tip, [nonminimaltx_3]), **BADINPUTS_ERROR) | ||||
self.log.info( | self.log.info( | ||||
"If we try to submit it by mempool or RPC we still aren't banned") | "If we try to submit it by mempool or RPC we still aren't banned") | ||||
assert_raises_rpc_error(-26, rpc_error(**MINIMALPUSH_ERROR), | assert_raises_rpc_error(-26, rpc_error(**MINIMALPUSH_ERROR), | ||||
node.sendrawtransaction, ToHex(nonminimaltx_3)) | node.sendrawtransaction, ToHex(nonminimaltx_3)) | ||||
Show All 10 Lines |