|
|
|
@ -1,5 +1,5 @@
|
|
|
|
|
#!/usr/bin/env python3
|
|
|
|
|
# Copyright (c) 2014-2018 The Bitcoin Core developers
|
|
|
|
|
# Copyright (c) 2014-2019 The Bitcoin Core developers
|
|
|
|
|
# Distributed under the MIT software license, see the accompanying
|
|
|
|
|
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
|
|
|
|
"""Test the wallet."""
|
|
|
|
@ -195,7 +195,7 @@ class WalletTest(BitcoinTestFramework):
|
|
|
|
|
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, self.get_vsize(self.nodes[2].getrawtransaction(txid)))
|
|
|
|
|
node_2_bal = self.check_fee_amount(self.nodes[2].getbalance(), Decimal('84'), fee_per_byte, self.get_vsize(self.nodes[2].gettransaction(txid)['hex']))
|
|
|
|
|
assert_equal(self.nodes[0].getbalance(), Decimal('10'))
|
|
|
|
|
|
|
|
|
|
# Send 10 BTC with subtract fee from amount
|
|
|
|
@ -204,14 +204,14 @@ class WalletTest(BitcoinTestFramework):
|
|
|
|
|
self.sync_all([self.nodes[0:3]])
|
|
|
|
|
node_2_bal -= Decimal('10')
|
|
|
|
|
assert_equal(self.nodes[2].getbalance(), node_2_bal)
|
|
|
|
|
node_0_bal = self.check_fee_amount(self.nodes[0].getbalance(), Decimal('20'), fee_per_byte, self.get_vsize(self.nodes[2].getrawtransaction(txid)))
|
|
|
|
|
node_0_bal = self.check_fee_amount(self.nodes[0].getbalance(), Decimal('20'), fee_per_byte, self.get_vsize(self.nodes[2].gettransaction(txid)['hex']))
|
|
|
|
|
|
|
|
|
|
# Sendmany 10 BTC
|
|
|
|
|
txid = self.nodes[2].sendmany('', {address: 10}, 0, "", [])
|
|
|
|
|
self.nodes[2].generate(1)
|
|
|
|
|
self.sync_all([self.nodes[0:3]])
|
|
|
|
|
node_0_bal += Decimal('10')
|
|
|
|
|
node_2_bal = self.check_fee_amount(self.nodes[2].getbalance(), node_2_bal - Decimal('10'), fee_per_byte, self.get_vsize(self.nodes[2].getrawtransaction(txid)))
|
|
|
|
|
node_2_bal = self.check_fee_amount(self.nodes[2].getbalance(), node_2_bal - Decimal('10'), fee_per_byte, self.get_vsize(self.nodes[2].gettransaction(txid)['hex']))
|
|
|
|
|
assert_equal(self.nodes[0].getbalance(), node_0_bal)
|
|
|
|
|
|
|
|
|
|
# Sendmany 10 BTC with subtract fee from amount
|
|
|
|
@ -220,7 +220,7 @@ class WalletTest(BitcoinTestFramework):
|
|
|
|
|
self.sync_all([self.nodes[0:3]])
|
|
|
|
|
node_2_bal -= Decimal('10')
|
|
|
|
|
assert_equal(self.nodes[2].getbalance(), node_2_bal)
|
|
|
|
|
node_0_bal = self.check_fee_amount(self.nodes[0].getbalance(), node_0_bal + Decimal('10'), fee_per_byte, self.get_vsize(self.nodes[2].getrawtransaction(txid)))
|
|
|
|
|
node_0_bal = self.check_fee_amount(self.nodes[0].getbalance(), node_0_bal + Decimal('10'), fee_per_byte, self.get_vsize(self.nodes[2].gettransaction(txid)['hex']))
|
|
|
|
|
|
|
|
|
|
# Test ResendWalletTransactions:
|
|
|
|
|
# Create a couple of transactions, then start up a fourth
|
|
|
|
@ -481,7 +481,7 @@ class WalletTest(BitcoinTestFramework):
|
|
|
|
|
self.nodes[0].generate(1)
|
|
|
|
|
destination = self.nodes[1].getnewaddress()
|
|
|
|
|
txid = self.nodes[0].sendtoaddress(destination, 0.123)
|
|
|
|
|
tx = self.nodes[0].decoderawtransaction(self.nodes[0].getrawtransaction(txid))
|
|
|
|
|
tx = self.nodes[0].decoderawtransaction(self.nodes[0].gettransaction(txid)['hex'])
|
|
|
|
|
output_addresses = [vout['scriptPubKey']['addresses'][0] for vout in tx["vout"]]
|
|
|
|
|
assert len(output_addresses) > 1
|
|
|
|
|
for address in output_addresses:
|
|
|
|
|