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
0./src/bitcoin-cli -regtest getbalances
1{
2 "mine": {
3 "trusted": 14284.37500000,
4 "untrusted_pending": 0.00000000,
5 "immature": 254.68750000
6 },
7 "lastprocessedblock": {
8 "hash": "5ba7e8b9a9e6aed88b4641257ef13ecaace1211688f5b5fec99cad36e1650e5d",
9 "height": 786
10 }
11}
- gettransaction
0./src/bitcoin-cli -regtest gettransaction fa3fd022eaccd003d93a02f31848fc34d81e4e07a9a2e7690e49f92c8c1004cb
1 [...snip...]
2 "lastprocessedblock": {
3 "hash": "592d87f3f7ff48ddf1ae07dcd0003de9e484c0df00be3b78a9681c84d607e030",
4 "height": 796
5 }
6}
- getwalletinfo
0./src/bitcoin-cli -regtest getwalletinfo
1{
2 "walletname": "",
3 "walletversion": 169900,
4 "balance": 14315.62500000,
5 [...snip...]
6 "lastprocessedblock": {
7 "hash": "592d87f3f7ff48ddf1ae07dcd0003de9e484c0df00be3b78a9681c84d607e030",
8 "height": 796
9 }
10}
Changes:
- Introduced a new wallet function
GetLastBlockHash
to returnm_last_block_processed
- Introduced helper function
AppendLastProcessedBlock
to insert JSON objects - Introduced static RPCResult variable
RESULT_LAST_PROCESSED_BLOCK
for 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.