This PR expands the JSONs returned from getbalances, gettransaction and getwalletinfo RPCs by adding a new property: lastprocessedblock that contains the hash and height of the block.
- getbalances
./src/bitcoin-cli -regtest getbalances
{
"mine": {
"trusted": 14284.37500000,
"untrusted_pending": 0.00000000,
"immature": 254.68750000
},
"lastprocessedblock": {
"hash": "5ba7e8b9a9e6aed88b4641257ef13ecaace1211688f5b5fec99cad36e1650e5d",
"height": 786
}
}
- gettransaction
./src/bitcoin-cli -regtest gettransaction fa3fd022eaccd003d93a02f31848fc34d81e4e07a9a2e7690e49f92c8c1004cb
[...snip...]
"lastprocessedblock": {
"hash": "592d87f3f7ff48ddf1ae07dcd0003de9e484c0df00be3b78a9681c84d607e030",
"height": 796
}
}
- getwalletinfo
./src/bitcoin-cli -regtest getwalletinfo
{
"walletname": "",
"walletversion": 169900,
"balance": 14315.62500000,
[...snip...]
"lastprocessedblock": {
"hash": "592d87f3f7ff48ddf1ae07dcd0003de9e484c0df00be3b78a9681c84d607e030",
"height": 796
}
}
Changes:
- Introduced a new wallet function
GetLastBlockHashto returnm_last_block_processed - Introduced helper function
AppendLastProcessedBlockto insert JSON objects - Introduced static RPCResult variable
RESULT_LAST_PROCESSED_BLOCKfor JSON reuse - Added tests in
tests/functional/wallet_balance.py - Added release-notes-18570.md
The motivation for this PR can be found here #18567
The idea to make lastprocessedblock an object that contains both hash and height is from vasild. Originally, only the hash was shown.
