Changeset View
Changeset View
Standalone View
Standalone View
test/functional/mempool_reorg.py
Show First 20 Lines • Show All 49 Lines • ▼ Show 20 Lines | def run_test(self): | ||||
# 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}) | [{"txid": coinbase_txids[0], "vout": 0}], {node0_address: 49.99}) | ||||
# Set the time lock | # Set the time lock | ||||
timelock_tx = timelock_tx.replace("ffffffff", "11111191", 1) | timelock_tx = timelock_tx.replace("ffffffff", "11111191", 1) | ||||
timelock_tx = timelock_tx[:-8] + \ | timelock_tx = timelock_tx[:-8] + \ | ||||
hex(self.nodes[0].getblockcount() + 2)[2:] + "000000" | hex(self.nodes[0].getblockcount() + 2)[2:] + "000000" | ||||
timelock_tx = self.nodes[0].signrawtransaction(timelock_tx)["hex"] | timelock_tx = self.nodes[0].signrawtransactionwithwallet(timelock_tx)[ | ||||
"hex"] | |||||
# This will raise an exception because the timelock transaction is too immature to spend | # This will raise an exception because the timelock transaction is too 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: | ||||
spend_102_id = self.nodes[0].sendrawtransaction(spend_102_raw) | spend_102_id = self.nodes[0].sendrawtransaction(spend_102_raw) | ||||
spend_103_id = self.nodes[0].sendrawtransaction(spend_103_raw) | spend_103_id = self.nodes[0].sendrawtransaction(spend_103_raw) | ||||
self.nodes[0].generate(1) | self.nodes[0].generate(1) | ||||
▲ Show 20 Lines • Show All 45 Lines • Show Last 20 Lines |