wallet, rpc: add include_change parameter to listtransactions#35009
wallet, rpc: add include_change parameter to listtransactions#35009alfonsoromanz wants to merge 2 commits intobitcoin:masterfrom
Conversation
|
The following sections might be updated with supplementary metadata relevant to reviewers and maintainers. ReviewsSee the guideline for information on the review process.
If your review is incorrectly listed, please copy-paste ConflictsReviewers, this pull request conflicts with the following ones:
If you consider this pull request important, please also help to review the conflicting pull requests. Ideally, start with the one that should be merged first. LLM Linter (✨ experimental)Possible places where named args for integral literals may be used (e.g.
2026-04-07 11:05:05 |
62df79e to
53d55d8
Compare
listsinceblock already supports an include_change parameter, and the internal ListTransactions helper already accepts it. Wire this parameter through the listtransactions RPC handler for consistency. Since all callers of ListTransactions now pass include_change explicitly, remove the default value to ensure future callers do too. This addresses the issue reported in bitcoin#34632, where transactions sending exclusively to change addresses are silently hidden from listtransactions.
Verify that listtransactions with include_change=true returns receive and send entries for change outputs. Mirrors the existing test_send_to_self test in wallet_listsinceblock.py.
53d55d8 to
0ef6fff
Compare
|
Force-pushed to address @achow101's feedback. |
|
ACK 0ef6fff |
|
|
I agree that change should not appear at all, but if it were to be shown, they should be (and are) shown as send to self, which we show as separate send and receive transactions. |
Currently,
listtransactionssilently hides transactions whose outputs go exclusively to change addresses. This can be confusing, as reported in #34632: a user created a consolidation transaction sending funds to a change address, and the transaction disappeared fromlisttransactions, making it appear as though funds were lost.listsinceblockalready supports aninclude_changeparameter for this purpose. The internalListTransactionshelper also already accepts it. This PR simply wires the parameter through thelisttransactionsRPC handler for consistency.include_change(bool, defaultfalse) as a new argument after the existinginclude_watchonlyThis approach was suggested by @mossein in #34632. A more comprehensive
listrawtransactionsRPC as mentioned by @achow101 could be pursued separately.Fixes #34632