Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions src/wallet/rpcwallet.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3721,12 +3721,13 @@ UniValue getwalletinfo(const JSONRPCRequest& request)
" \"immature_balance\": xxxxxx, (numeric) the total immature balance of the wallet in PIV\n"
" \"txcount\": xxxxxxx, (numeric) the total number of transactions in the wallet\n"
" \"keypoololdest\": xxxxxx, (numeric) the timestamp (seconds since GMT epoch) of the oldest pre-generated key in the key pool\n"
" \"keypoolsize\": xxxx, (numeric) how many new keys are pre-generated (only counts external keys)\n"
" \"keypoolsize_hd_internal\": xxxx, (numeric) how many new keys are pre-generated for internal use (used for change outputs, only appears if the wallet is using this feature, otherwise external keys are used)\n"
" \"keypoolsize_hd_staking\": xxxx, (numeric) how many new keys are pre-generated for staking use (used for staking contracts, only appears if the wallet is using this feature)\n"
" \"keypoolsize\": xxxx, (numeric) how many new keys are pre-generated (only counts external keys)\n"
" \"keypoolsize_hd_internal\": xxxx, (numeric) how many new keys are pre-generated for internal use (used for change outputs, only appears if the wallet is using this feature, otherwise external keys are used)\n"
" \"keypoolsize_hd_staking\": xxxx, (numeric) how many new keys are pre-generated for staking use (used for staking contracts, only appears if the wallet is using this feature)\n"
" \"unlocked_until\": ttt, (numeric) the timestamp in seconds since epoch (midnight Jan 1 1970 GMT) that the wallet is unlocked for transfers, or 0 if the wallet is locked\n"
" \"paytxfee\": x.xxxx (numeric) the transaction fee configuration, set in PIV/kB\n"
" \"hdseedid\": \"<hash160>\" (string, optional) the Hash160 of the HD seed (only present when HD is enabled)\n"
" \"hdseedid\": \"<hash160>\" (string, optional) the Hash160 of the HD seed (only present when HD is enabled)\n"
" \"last_processed_block\": xxxxx, (numeric) the last block processed block height\n"
"}\n"

"\nExamples:\n" +
Expand Down Expand Up @@ -3768,6 +3769,7 @@ UniValue getwalletinfo(const JSONRPCRequest& request)
if (pwalletMain->IsCrypted())
obj.pushKV("unlocked_until", nWalletUnlockTime);
obj.pushKV("paytxfee", ValueFromAmount(payTxFee.GetFeePerK()));
obj.pushKV("last_processed_block", pwalletMain->GetLastBlockHeight());
return obj;
}

Expand Down
2 changes: 2 additions & 0 deletions test/functional/mining_pos_coldStaking.py
Original file line number Diff line number Diff line change
Expand Up @@ -421,13 +421,15 @@ def run_test(self):

def checkBalances(self):
w_info = self.nodes[0].getwalletinfo()
assert_equal(self.nodes[0].getblockcount(), w_info['last_processed_block'])
self.log.info("OWNER - Delegated %f / Cold %f [%f / %f]" % (
float(w_info["delegated_balance"]), w_info["cold_staking_balance"],
float(w_info["immature_delegated_balance"]), w_info["immature_cold_staking_balance"]))
assert_equal(float(w_info["delegated_balance"]), self.expected_balance)
assert_equal(float(w_info["immature_delegated_balance"]), self.expected_immature_balance)
assert_equal(float(w_info["cold_staking_balance"]), 0)
w_info = self.nodes[1].getwalletinfo()
assert_equal(self.nodes[1].getblockcount(), w_info['last_processed_block'])
self.log.info("STAKER - Delegated %f / Cold %f [%f / %f]" % (
float(w_info["delegated_balance"]), w_info["cold_staking_balance"],
float(w_info["immature_delegated_balance"]), w_info["immature_cold_staking_balance"]))
Expand Down
1 change: 1 addition & 0 deletions test/functional/mining_pos_reorg.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ def disconnect_all(self):

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

def check_money_supply(self, expected_piv):
Expand Down
1 change: 1 addition & 0 deletions test/functional/sapling_wallet_anchorfork.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ def run_test (self):
self.sync_all()

walletinfo = self.nodes[0].getwalletinfo()
assert_equal(self.nodes[0].getblockcount(), walletinfo['last_processed_block'])
assert_equal(walletinfo['immature_balance'], 1000)
assert_equal(walletinfo['balance'], 0)

Expand Down
11 changes: 10 additions & 1 deletion test/functional/wallet_basic.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,9 @@ def setup_network(self):
def get_vsize(self, txn):
return self.nodes[0].decoderawtransaction(txn)['size']

def check_wallet_processed_blocks(self, nodeid, walletinfo):
assert_equal(self.nodes[nodeid].getblockcount(), walletinfo['last_processed_block'])

def run_test(self):
# Check that there's no UTXO on none of the nodes
assert_equal(len(self.nodes[0].listunspent()), 0)
Expand All @@ -43,6 +46,7 @@ def run_test(self):
self.nodes[0].generate(1)

walletinfo = self.nodes[0].getwalletinfo()
self.check_wallet_processed_blocks(0, walletinfo)
assert_equal(walletinfo['immature_balance'], 250)
assert_equal(walletinfo['balance'], 0)

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

walletinfo = self.nodes[0].getwalletinfo()
self.check_wallet_processed_blocks(0, walletinfo)
self.check_wallet_processed_blocks(1, self.nodes[1].getwalletinfo())
self.check_wallet_processed_blocks(2, self.nodes[2].getwalletinfo())

# Check that only first and second nodes have UTXOs
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)

walletinfo = self.nodes[0].getwalletinfo()
assert_equal(walletinfo['immature_balance'], 0)

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

# Exercise listsinceblock with the last two blocks
self.check_wallet_processed_blocks(0, self.nodes[0].getwalletinfo())
coinbase_tx_1 = self.nodes[0].listsinceblock(blocks[0])
assert_equal(coinbase_tx_1["lastblock"], blocks[1])
assert_equal(len(coinbase_tx_1["transactions"]), 1)
Expand Down