Changeset View
Changeset View
Standalone View
Standalone View
test/functional/abandonconflict.py
Show First 20 Lines • Show All 43 Lines • ▼ Show 20 Lines | def run_test(self): | ||||
sync_blocks(self.nodes) | sync_blocks(self.nodes) | ||||
newbalance = self.nodes[0].getbalance() | newbalance = self.nodes[0].getbalance() | ||||
# no more than fees lost | # no more than fees lost | ||||
assert(balance - newbalance <= total_fees(txA, txB, txC)) | assert(balance - newbalance <= total_fees(txA, txB, txC)) | ||||
balance = newbalance | balance = newbalance | ||||
# Disconnect nodes so node0's transactions don't get into node1's mempool | # Disconnect nodes so node0's transactions don't get into node1's mempool | ||||
disconnect_nodes(self.nodes[0], 1) | disconnect_nodes(self.nodes[0], self.nodes[1]) | ||||
# Identify the 10btc outputs | # Identify the 10btc outputs | ||||
nA = next(i for i, vout in enumerate(self.nodes[0].getrawtransaction( | nA = next(i for i, vout in enumerate(self.nodes[0].getrawtransaction( | ||||
txA, 1)["vout"]) if vout["value"] == Decimal("10")) | txA, 1)["vout"]) if vout["value"] == Decimal("10")) | ||||
nB = next(i for i, vout in enumerate(self.nodes[0].getrawtransaction( | nB = next(i for i, vout in enumerate(self.nodes[0].getrawtransaction( | ||||
txB, 1)["vout"]) if vout["value"] == Decimal("10")) | txB, 1)["vout"]) if vout["value"] == Decimal("10")) | ||||
nC = next(i for i, vout in enumerate(self.nodes[0].getrawtransaction( | nC = next(i for i, vout in enumerate(self.nodes[0].getrawtransaction( | ||||
txC, 1)["vout"]) if vout["value"] == Decimal("10")) | txC, 1)["vout"]) if vout["value"] == Decimal("10")) | ||||
▲ Show 20 Lines • Show All 110 Lines • ▼ Show 20 Lines | def run_test(self): | ||||
inputs.append({"txid": txA, "vout": nA}) | inputs.append({"txid": txA, "vout": nA}) | ||||
outputs = {} | outputs = {} | ||||
outputs[self.nodes[1].getnewaddress()] = Decimal("9.9999") | outputs[self.nodes[1].getnewaddress()] = Decimal("9.9999") | ||||
tx = self.nodes[0].createrawtransaction(inputs, outputs) | tx = self.nodes[0].createrawtransaction(inputs, outputs) | ||||
signed = self.nodes[0].signrawtransaction(tx) | signed = self.nodes[0].signrawtransaction(tx) | ||||
self.nodes[1].sendrawtransaction(signed["hex"]) | self.nodes[1].sendrawtransaction(signed["hex"]) | ||||
self.nodes[1].generate(1) | self.nodes[1].generate(1) | ||||
connect_nodes(self.nodes[0], 1) | connect_nodes(self.nodes[0], self.nodes[1]) | ||||
sync_blocks(self.nodes) | sync_blocks(self.nodes) | ||||
# Verify that B and C's 10 BTC outputs are available for spending again because AB1 is now conflicted | # Verify that B and C's 10 BTC outputs are available for spending again because AB1 is now conflicted | ||||
newbalance = self.nodes[0].getbalance() | newbalance = self.nodes[0].getbalance() | ||||
assert_equal(newbalance, balance + Decimal("20")) | assert_equal(newbalance, balance + Decimal("20")) | ||||
balance = newbalance | balance = newbalance | ||||
# There is currently a minor bug around this and so this test doesn't work. See Issue #7315 | # There is currently a minor bug around this and so this test doesn't work. See Issue #7315 | ||||
Show All 14 Lines |