Changeset View
Changeset View
Standalone View
Standalone View
test/functional/txn_doublespend.py
Show First 20 Lines • Show All 103 Lines • ▼ Show 20 Lines | def run_test(self): | ||||
# Now give doublespend and its parents to miner: | # Now give doublespend and its parents to miner: | ||||
self.nodes[2].sendrawtransaction(fund_foo_tx["hex"]) | self.nodes[2].sendrawtransaction(fund_foo_tx["hex"]) | ||||
self.nodes[2].sendrawtransaction(fund_bar_tx["hex"]) | self.nodes[2].sendrawtransaction(fund_bar_tx["hex"]) | ||||
doublespend_txid = self.nodes[2].sendrawtransaction(doublespend["hex"]) | doublespend_txid = self.nodes[2].sendrawtransaction(doublespend["hex"]) | ||||
# ... mine a block... | # ... mine a block... | ||||
self.nodes[2].generate(1) | self.nodes[2].generate(1) | ||||
# Reconnect the split network, and sync chain: | # Reconnect the split network, and sync chain: | ||||
connect_nodes(self.nodes[1], 2) | connect_nodes(self.nodes[1], self.nodes[2]) | ||||
self.nodes[2].generate(1) # Mine another block to make sure we sync | self.nodes[2].generate(1) # Mine another block to make sure we sync | ||||
sync_blocks(self.nodes) | sync_blocks(self.nodes) | ||||
assert_equal(self.nodes[0].gettransaction( | assert_equal(self.nodes[0].gettransaction( | ||||
doublespend_txid)["confirmations"], 2) | doublespend_txid)["confirmations"], 2) | ||||
# Re-fetch transaction info: | # Re-fetch transaction info: | ||||
tx1 = self.nodes[0].gettransaction(txid1) | tx1 = self.nodes[0].gettransaction(txid1) | ||||
tx2 = self.nodes[0].gettransaction(txid2) | tx2 = self.nodes[0].gettransaction(txid2) | ||||
Show All 32 Lines |