Changeset View
Changeset View
Standalone View
Standalone View
test/functional/mempool_reorg.py
Show First 20 Lines • Show All 50 Lines • ▼ Show 20 Lines | def run_test(self): | ||||
self.nodes[0], coinbase_txids[1], node1_address, amount=49.99) | self.nodes[0], coinbase_txids[1], node1_address, amount=49.99) | ||||
spend_102_raw = create_raw_transaction( | spend_102_raw = create_raw_transaction( | ||||
self.nodes[0], coinbase_txids[2], node0_address, amount=49.99) | self.nodes[0], coinbase_txids[2], node0_address, amount=49.99) | ||||
spend_103_raw = create_raw_transaction( | spend_103_raw = create_raw_transaction( | ||||
self.nodes[0], coinbase_txids[3], node0_address, amount=49.99) | self.nodes[0], coinbase_txids[3], node0_address, amount=49.99) | ||||
# Create a transaction which is time-locked to two blocks in the future | # Create a transaction which is time-locked to two blocks in the future | ||||
timelock_tx = self.nodes[0].createrawtransaction( | timelock_tx = self.nodes[0].createrawtransaction( | ||||
[{"txid": coinbase_txids[0], "vout": 0}], {node0_address: 49.99}) | inputs=[{ | ||||
# Set the time lock | "txid": coinbase_txids[0], | ||||
timelock_tx = timelock_tx.replace("ffffffff", "11111191", 1) | "vout": 0 | ||||
timelock_tx = timelock_tx[:-8] + \ | }], | ||||
hex(self.nodes[0].getblockcount() + 2)[2:] + "000000" | outputs={node0_address: 49.99}, | ||||
locktime=self.nodes[0].getblockcount() + 2, | |||||
) | |||||
timelock_tx = self.nodes[0].signrawtransactionwithwallet(timelock_tx)[ | timelock_tx = self.nodes[0].signrawtransactionwithwallet(timelock_tx)[ | ||||
"hex"] | "hex"] | ||||
# This will raise an exception because the timelock transaction is too | # This will raise an exception because the timelock transaction is too | ||||
# immature to spend | # immature to spend | ||||
assert_raises_rpc_error(-26, "bad-txns-nonfinal", | assert_raises_rpc_error(-26, "bad-txns-nonfinal", | ||||
self.nodes[0].sendrawtransaction, timelock_tx) | self.nodes[0].sendrawtransaction, timelock_tx) | ||||
# Broadcast and mine spend_102 and 103: | # Broadcast and mine spend_102 and 103: | ||||
▲ Show 20 Lines • Show All 53 Lines • Show Last 20 Lines |