mirror of
https://github.com/dashpay/dash.git
synced 2024-12-25 12:02:48 +01:00
Merge #10256: [test] Add test for gettxout to wallet.py
dd1ea59
[test] Add gettxout call (Jimmy Song)
Tree-SHA512: 5cea3763de30ec09b6e28b5a0c70f44d0c72a5b6ce159fdc95c1d43689ccfd21a32002d075c47cf011f66e505d9b97ea679c7c8825081a078543472e3e5083fb
adjust tests values * 10
Signed-off-by: Pasta <Pasta@dash.org>
This commit is contained in:
parent
ed68d2ca12
commit
c2dd5cd339
@ -6,7 +6,7 @@
|
||||
from test_framework.test_framework import BitcoinTestFramework
|
||||
from test_framework.util import *
|
||||
|
||||
class WalletTest (BitcoinTestFramework):
|
||||
class WalletTest(BitcoinTestFramework):
|
||||
|
||||
def check_fee_amount(self, curr_balance, balance_with_fee, fee_per_byte, tx_size):
|
||||
"""Return curr_balance after asserting the fee was in range"""
|
||||
@ -28,7 +28,7 @@ class WalletTest (BitcoinTestFramework):
|
||||
self.is_network_split=False
|
||||
self.sync_all()
|
||||
|
||||
def run_test (self):
|
||||
def run_test(self):
|
||||
|
||||
# Check that there's no UTXO on none of the nodes
|
||||
assert_equal(len(self.nodes[0].listunspent()), 0)
|
||||
@ -52,14 +52,34 @@ class WalletTest (BitcoinTestFramework):
|
||||
assert_equal(self.nodes[2].getbalance(), 0)
|
||||
|
||||
# Check that only first and second nodes have UTXOs
|
||||
assert_equal(len(self.nodes[0].listunspent()), 1)
|
||||
utxos = self.nodes[0].listunspent()
|
||||
assert_equal(len(utxos), 1)
|
||||
assert_equal(len(self.nodes[1].listunspent()), 1)
|
||||
assert_equal(len(self.nodes[2].listunspent()), 0)
|
||||
|
||||
# Send 210 DASH from 0 to 2 using sendtoaddress call.
|
||||
# Second transaction will be child of first, and will require a fee
|
||||
self.nodes[0].sendtoaddress(self.nodes[2].getnewaddress(), 110)
|
||||
self.nodes[0].sendtoaddress(self.nodes[2].getnewaddress(), 100)
|
||||
mempool_txid = self.nodes[0].sendtoaddress(self.nodes[2].getnewaddress(), 100)
|
||||
|
||||
self.log.info("test gettxout")
|
||||
# utxo spent in mempool should be visible if you exclude mempool
|
||||
# but invisible if you include mempool
|
||||
confirmed_txid, confirmed_index = utxos[0]["txid"], utxos[0]["vout"]
|
||||
txout = self.nodes[0].gettxout(confirmed_txid, confirmed_index, False)
|
||||
assert_equal(txout['value'], 500)
|
||||
txout = self.nodes[0].gettxout(confirmed_txid, confirmed_index, True)
|
||||
assert txout is None
|
||||
# new utxo from mempool should be invisible if you exclude mempool
|
||||
# but visible if you include mempool
|
||||
txout = self.nodes[0].gettxout(mempool_txid, 0, False)
|
||||
assert txout is None
|
||||
txout1 = self.nodes[0].gettxout(mempool_txid, 0, True)
|
||||
txout2 = self.nodes[0].gettxout(mempool_txid, 1, True)
|
||||
# note the mempool tx will have randomly assigned indices
|
||||
# but 10 will go to node2 and the rest will go to node0
|
||||
balance = self.nodes[0].getbalance()
|
||||
assert_equal(set([txout1['value'], txout2['value']]), set([100, balance]))
|
||||
|
||||
walletinfo = self.nodes[0].getwalletinfo()
|
||||
assert_equal(walletinfo['immature_balance'], 0)
|
||||
|
Loading…
Reference in New Issue
Block a user