Skip to content

Commit 7f244b1

Browse files
random-zebrafurszy
authored andcommitted
[Tests] Check last_processed_block in getwalletinfo
Github-Pull: #2283 Rebased-From: a700fdf
1 parent b3a12b5 commit 7f244b1

File tree

4 files changed

+14
-1
lines changed

4 files changed

+14
-1
lines changed

test/functional/mining_pos_coldStaking.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -421,13 +421,15 @@ def run_test(self):
421421

422422
def checkBalances(self):
423423
w_info = self.nodes[0].getwalletinfo()
424+
assert_equal(self.nodes[0].getblockcount(), w_info['last_processed_block'])
424425
self.log.info("OWNER - Delegated %f / Cold %f [%f / %f]" % (
425426
float(w_info["delegated_balance"]), w_info["cold_staking_balance"],
426427
float(w_info["immature_delegated_balance"]), w_info["immature_cold_staking_balance"]))
427428
assert_equal(float(w_info["delegated_balance"]), self.expected_balance)
428429
assert_equal(float(w_info["immature_delegated_balance"]), self.expected_immature_balance)
429430
assert_equal(float(w_info["cold_staking_balance"]), 0)
430431
w_info = self.nodes[1].getwalletinfo()
432+
assert_equal(self.nodes[1].getblockcount(), w_info['last_processed_block'])
431433
self.log.info("STAKER - Delegated %f / Cold %f [%f / %f]" % (
432434
float(w_info["delegated_balance"]), w_info["cold_staking_balance"],
433435
float(w_info["immature_delegated_balance"]), w_info["immature_cold_staking_balance"]))

test/functional/mining_pos_reorg.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ def disconnect_all(self):
4747

4848
def get_tot_balance(self, nodeid):
4949
wi = self.nodes[nodeid].getwalletinfo()
50+
assert_equal(self.nodes[nodeid].getblockcount(), wi['last_processed_block'])
5051
return wi['balance'] + wi['immature_balance']
5152

5253
def check_money_supply(self, expected_piv):

test/functional/sapling_wallet_anchorfork.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ def run_test (self):
2424
self.sync_all()
2525

2626
walletinfo = self.nodes[0].getwalletinfo()
27+
assert_equal(self.nodes[0].getblockcount(), walletinfo['last_processed_block'])
2728
assert_equal(walletinfo['immature_balance'], 1000)
2829
assert_equal(walletinfo['balance'], 0)
2930

test/functional/wallet_basic.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,9 @@ def setup_network(self):
3232
def get_vsize(self, txn):
3333
return self.nodes[0].decoderawtransaction(txn)['size']
3434

35+
def check_wallet_processed_blocks(self, nodeid, walletinfo):
36+
assert_equal(self.nodes[nodeid].getblockcount(), walletinfo['last_processed_block'])
37+
3538
def run_test(self):
3639
# Check that there's no UTXO on none of the nodes
3740
assert_equal(len(self.nodes[0].listunspent()), 0)
@@ -43,6 +46,7 @@ def run_test(self):
4346
self.nodes[0].generate(1)
4447

4548
walletinfo = self.nodes[0].getwalletinfo()
49+
self.check_wallet_processed_blocks(0, walletinfo)
4650
assert_equal(walletinfo['immature_balance'], 250)
4751
assert_equal(walletinfo['balance'], 0)
4852

@@ -54,13 +58,17 @@ def run_test(self):
5458
assert_equal(self.nodes[1].getbalance(), 250)
5559
assert_equal(self.nodes[2].getbalance(), 0)
5660

61+
walletinfo = self.nodes[0].getwalletinfo()
62+
self.check_wallet_processed_blocks(0, walletinfo)
63+
self.check_wallet_processed_blocks(1, self.nodes[1].getwalletinfo())
64+
self.check_wallet_processed_blocks(2, self.nodes[2].getwalletinfo())
65+
5766
# Check that only first and second nodes have UTXOs
5867
utxos = self.nodes[0].listunspent()
5968
assert_equal(len(utxos), 1)
6069
assert_equal(len(self.nodes[1].listunspent()), 1)
6170
assert_equal(len(self.nodes[2].listunspent()), 0)
6271

63-
walletinfo = self.nodes[0].getwalletinfo()
6472
assert_equal(walletinfo['immature_balance'], 0)
6573

6674
# Exercise locking of unspent outputs
@@ -185,6 +193,7 @@ def run_test(self):
185193
assert_equal(balance_nodes, [self.nodes[i].getbalance() for i in range(3)])
186194

187195
# Exercise listsinceblock with the last two blocks
196+
self.check_wallet_processed_blocks(0, self.nodes[0].getwalletinfo())
188197
coinbase_tx_1 = self.nodes[0].listsinceblock(blocks[0])
189198
assert_equal(coinbase_tx_1["lastblock"], blocks[1])
190199
assert_equal(len(coinbase_tx_1["transactions"]), 1)

0 commit comments

Comments
 (0)