Changeset View
Changeset View
Standalone View
Standalone View
test/functional/wallet_txn_doublespend.py
Show First 20 Lines • Show All 62 Lines • ▼ Show 20 Lines | def run_test(self): | ||||
rawtx_input_1["txid"] = fund_bar_txid | rawtx_input_1["txid"] = fund_bar_txid | ||||
rawtx_input_1["vout"] = find_output(self.nodes[0], fund_bar_txid, 29) | rawtx_input_1["vout"] = find_output(self.nodes[0], fund_bar_txid, 29) | ||||
inputs = [rawtx_input_0, rawtx_input_1] | inputs = [rawtx_input_0, rawtx_input_1] | ||||
change_address = self.nodes[0].getnewaddress() | change_address = self.nodes[0].getnewaddress() | ||||
outputs = {} | outputs = {} | ||||
outputs[node1_address] = 1240 | outputs[node1_address] = 1240 | ||||
outputs[change_address] = 1248 - 1240 + doublespend_fee | outputs[change_address] = 1248 - 1240 + doublespend_fee | ||||
rawtx = self.nodes[0].createrawtransaction(inputs, outputs) | rawtx = self.nodes[0].createrawtransaction(inputs, outputs) | ||||
doublespend = self.nodes[0].signrawtransaction(rawtx) | doublespend = self.nodes[0].signrawtransactionwithwallet(rawtx) | ||||
assert_equal(doublespend["complete"], True) | assert_equal(doublespend["complete"], True) | ||||
# Create two spends using 1 50 BTC coin each | # Create two spends using 1 50 BTC coin each | ||||
txid1 = self.nodes[0].sendfrom("foo", node1_address, 40, 0) | txid1 = self.nodes[0].sendfrom("foo", node1_address, 40, 0) | ||||
txid2 = self.nodes[0].sendfrom("bar", node1_address, 20, 0) | txid2 = self.nodes[0].sendfrom("bar", node1_address, 20, 0) | ||||
# Have node0 mine a block: | # Have node0 mine a block: | ||||
if (self.options.mine_block): | if (self.options.mine_block): | ||||
▲ Show 20 Lines • Show All 80 Lines • Show Last 20 Lines |