Changeset View
Changeset View
Standalone View
Standalone View
test/functional/p2p_invalid_tx.py
Show First 20 Lines • Show All 59 Lines • ▼ Show 20 Lines | def run_test(self): | ||||
best_block = self.nodes[0].getbestblockhash() | best_block = self.nodes[0].getbestblockhash() | ||||
tip = int(best_block, 16) | tip = int(best_block, 16) | ||||
best_block_time = self.nodes[0].getblock(best_block)['time'] | best_block_time = self.nodes[0].getblock(best_block)['time'] | ||||
block_time = best_block_time + 1 | block_time = best_block_time + 1 | ||||
self.log.info("Create a new block with an anyone-can-spend coinbase.") | self.log.info("Create a new block with an anyone-can-spend coinbase.") | ||||
height = 1 | height = 1 | ||||
block = create_block(tip, create_coinbase(height), block_time) | block = create_block(tip, create_coinbase(height), block_time) | ||||
block_time += 1 | |||||
block.solve() | block.solve() | ||||
# Save the coinbase for later | # Save the coinbase for later | ||||
block1 = block | block1 = block | ||||
tip = block.sha256 | tip = block.sha256 | ||||
height += 1 | |||||
node.p2p.send_blocks_and_test([block], node, success=True) | node.p2p.send_blocks_and_test([block], node, success=True) | ||||
self.log.info("Mature the block.") | self.log.info("Mature the block.") | ||||
self.nodes[0].generate(100) | self.nodes[0].generate(100) | ||||
# b'\x64' is OP_NOTIF | # b'\x64' is OP_NOTIF | ||||
# Transaction will be rejected with code 16 (REJECT_INVALID) | # Transaction will be rejected with code 16 (REJECT_INVALID) | ||||
# and we get disconnected immediately | # and we get disconnected immediately | ||||
▲ Show 20 Lines • Show All 90 Lines • Show Last 20 Lines |