Merge bitcoin/bitcoin#26094: rpc: Return block hash & height in getbalances, gettransaction and getwalletinfo #1140
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Backport Summary
This PR backports Bitcoin Core PR bitcoin#26094 (commit
da9f62f912) which adds block hash and height information to wallet RPC responses.Changes
Bitcoin commit:
da9f62f912(May 2, 2023)Original PR: bitcoin#26094
The backport adds
lastprocessedblockfield containing block hash and height to the following RPC endpoints:getbalances- Returns balance information with block contextgettransaction- Returns transaction details with block contextgetwalletinfo- Returns wallet state with block contextDash-Specific Adaptations
Preserved Dash wallet fields: Maintained Dash-specific fields in
getwalletinfoincluding:coinjoin_balancein balance fieldshdchainid,hdaccountcount,hdaccountsfor HD wallet structuretimefirstkey,keys_leftfor key managementSkipped external_signer: Bitcoin's
external_signerfeature is not present in Dash, so this field was not added togetwalletinfo.Test adaptations:
wallet_basic.pyto expectlastprocessedblockfield while preserving Dash-specific fields (chainlock, instantlock)wallet_orphanedreward.pyto handlelastprocessedblockin balance comparisons while keeping Dash'scoinjoinfieldImplementation Details
Added helper function
AppendLastProcessedBlock()insrc/wallet/rpc/util.cppthat appends block hash and height to RPC response objects. This function is called at the end of:getbalances()insrc/wallet/rpc/coins.cppgettransaction()insrc/wallet/rpc/transactions.cppgetwalletinfo()insrc/wallet/rpc/wallet.cppTesting
Functional tests updated to handle the new
lastprocessedblockfield in RPC responses.Generated with Claude Code
Co-Authored-By: Claude noreply@anthropic.com