Changeset View
Changeset View
Standalone View
Standalone View
test/functional/abandonconflict.py
Show All 12 Lines | |||||
from test_framework.test_framework import BitcoinTestFramework | from test_framework.test_framework import BitcoinTestFramework | ||||
from test_framework.util import * | from test_framework.util import * | ||||
from test_framework.mininode import * | from test_framework.mininode import * | ||||
class AbandonConflictTest(BitcoinTestFramework): | class AbandonConflictTest(BitcoinTestFramework): | ||||
def set_test_params(self): | def set_test_params(self): | ||||
self.num_nodes = 2 | self.num_nodes = 2 | ||||
self.extra_args = [["-minrelaytxfee=0.00001"], []] | self.extra_args = [["-minrelaytxfee=0.00001", | ||||
"-deprecatedrpc=signrawtransaction"], []] | |||||
def run_test(self): | def run_test(self): | ||||
def total_fees(*txids): | def total_fees(*txids): | ||||
total = 0 | total = 0 | ||||
for txid in txids: | for txid in txids: | ||||
ctx = FromHex(CTransaction(), | ctx = FromHex(CTransaction(), | ||||
self.nodes[0].getrawtransaction(txid)) | self.nodes[0].getrawtransaction(txid)) | ||||
total += self.nodes[0].calculate_fee_from_txid(txid) | total += self.nodes[0].calculate_fee_from_txid(txid) | ||||
▲ Show 20 Lines • Show All 124 Lines • ▼ Show 20 Lines | def run_test(self): | ||||
self.nodes[0].sendrawtransaction(signed2["hex"]) | self.nodes[0].sendrawtransaction(signed2["hex"]) | ||||
newbalance = self.nodes[0].getbalance() | newbalance = self.nodes[0].getbalance() | ||||
assert_equal(newbalance, balance - Decimal("10") - | assert_equal(newbalance, balance - Decimal("10") - | ||||
Decimal("14.99998") + Decimal("24.9996")) | Decimal("14.99998") + Decimal("24.9996")) | ||||
balance = newbalance | balance = newbalance | ||||
# Reset to a higher relay fee so that we abandon a transaction | # Reset to a higher relay fee so that we abandon a transaction | ||||
self.stop_node(0) | self.stop_node(0) | ||||
self.start_node(0, extra_args=["-minrelaytxfee=0.0001"]) | self.start_node( | ||||
0, extra_args=["-minrelaytxfee=0.0001", "-deprecatedrpc=signrawtransaction"]) | |||||
assert_equal(len(self.nodes[0].getrawmempool()), 0) | assert_equal(len(self.nodes[0].getrawmempool()), 0) | ||||
newbalance = self.nodes[0].getbalance() | newbalance = self.nodes[0].getbalance() | ||||
assert_equal(newbalance, balance - Decimal("24.9996")) | assert_equal(newbalance, balance - Decimal("24.9996")) | ||||
balance = newbalance | balance = newbalance | ||||
# Create a double spend of AB1. Spend it again from only A's 10 output. | # Create a double spend of AB1. Spend it again from only A's 10 output. | ||||
# Mine double spend from node 1. | # Mine double spend from node 1. | ||||
inputs = [] | inputs = [] | ||||
Show All 31 Lines |