diff --git a/test/functional/wallet.py b/test/functional/wallet.py --- a/test/functional/wallet.py +++ b/test/functional/wallet.py @@ -5,6 +5,7 @@ """Test the wallet.""" from test_framework.test_framework import BitcoinTestFramework from test_framework.util import * +from test_framework.mininode import * class WalletTest(BitcoinTestFramework): @@ -153,14 +154,16 @@ assert_equal(self.nodes[2].getbalance("from1"), 94 - 21) # Send 10 BTC normal + old_balance = self.nodes[2].getbalance() address = self.nodes[0].getnewaddress("test") fee_per_byte = Decimal('0.001') / 1000 self.nodes[2].settxfee(fee_per_byte * 1000) txid = self.nodes[2].sendtoaddress(address, 10, "", "", False) self.nodes[2].generate(1) self.sync_all([self.nodes[0:3]]) - node_2_bal = self.check_fee_amount(self.nodes[2].getbalance(), Decimal( - '84'), fee_per_byte, count_bytes(self.nodes[2].getrawtransaction(txid))) + ctx = FromHex(CTransaction(), self.nodes[2].getrawtransaction(txid)) + node_2_bal = self.check_fee_amount(self.nodes[2].getbalance(), old_balance - Decimal('10'), + fee_per_byte, ctx.billable_size()) assert_equal(self.nodes[0].getbalance(), Decimal('10')) # Send 10 BTC with subtract fee from amount @@ -177,8 +180,9 @@ self.nodes[2].generate(1) self.sync_all([self.nodes[0:3]]) node_0_bal += Decimal('10') + ctx = FromHex(CTransaction(), self.nodes[2].getrawtransaction(txid)) node_2_bal = self.check_fee_amount(self.nodes[2].getbalance( - ), node_2_bal - Decimal('10'), fee_per_byte, count_bytes(self.nodes[2].getrawtransaction(txid))) + ), node_2_bal - Decimal('10'), fee_per_byte, ctx.billable_size()) assert_equal(self.nodes[0].getbalance(), node_0_bal) # Sendmany 10 BTC with subtract fee from amount @@ -187,8 +191,9 @@ self.sync_all([self.nodes[0:3]]) node_2_bal -= Decimal('10') assert_equal(self.nodes[2].getbalance(), node_2_bal) + ctx = FromHex(CTransaction(), self.nodes[2].getrawtransaction(txid)) node_0_bal = self.check_fee_amount(self.nodes[0].getbalance( - ), node_0_bal + Decimal('10'), fee_per_byte, count_bytes(self.nodes[2].getrawtransaction(txid))) + ), node_0_bal + Decimal('10'), fee_per_byte, ctx.billable_size()) # Test ResendWalletTransactions: # Create a couple of transactions, then start up a fourth