Changeset View
Changeset View
Standalone View
Standalone View
test/functional/bip65-cltv-p2p.py
Show First 20 Lines • Show All 88 Lines • ▼ Show 20 Lines | def run_test(self): | ||||
self.log.info("Mining %d blocks", CLTV_HEIGHT - 2) | self.log.info("Mining %d blocks", CLTV_HEIGHT - 2) | ||||
self.coinbase_blocks = self.nodes[0].generate(CLTV_HEIGHT - 2) | self.coinbase_blocks = self.nodes[0].generate(CLTV_HEIGHT - 2) | ||||
self.nodeaddress = self.nodes[0].getnewaddress() | self.nodeaddress = self.nodes[0].getnewaddress() | ||||
self.log.info( | self.log.info( | ||||
"Test that an invalid-according-to-CLTV transaction can still appear in a block") | "Test that an invalid-according-to-CLTV transaction can still appear in a block") | ||||
spendtx = create_transaction(self.nodes[0], self.coinbase_blocks[0], | spendtx = create_transaction(self.nodes[0], self.coinbase_blocks[0], | ||||
self.nodeaddress, 1.0) | self.nodeaddress, 50.0) | ||||
cltv_invalidate(spendtx) | cltv_invalidate(spendtx) | ||||
# Make sure the tx is valid | |||||
self.nodes[0].sendrawtransaction(bytes_to_hex_str(spendtx.serialize())) | |||||
tip = self.nodes[0].getbestblockhash() | tip = self.nodes[0].getbestblockhash() | ||||
block_time = self.nodes[0].getblockheader(tip)['mediantime'] + 1 | block_time = self.nodes[0].getblockheader(tip)['mediantime'] + 1 | ||||
block = create_block(int(tip, 16), create_coinbase( | block = create_block(int(tip, 16), create_coinbase( | ||||
CLTV_HEIGHT - 1), block_time) | CLTV_HEIGHT - 1), block_time) | ||||
block.nVersion = 3 | block.nVersion = 3 | ||||
block.vtx.append(spendtx) | block.vtx.append(spendtx) | ||||
block.hashMerkleRoot = block.calc_merkle_root() | block.hashMerkleRoot = block.calc_merkle_root() | ||||
block.solve() | block.solve() | ||||
▲ Show 20 Lines • Show All 73 Lines • Show Last 20 Lines |