Repository navigation
wallet, rpc: add include_change parameter to listtransactions - #35009
alfonsoromanz wants to merge 2 commits into
Conversation
|
The following sections might be updated with supplementary metadata relevant to reviewers and maintainers. Code Coverage & BenchmarksFor details see: https://corecheck.dev/bitcoin/bitcoin/pulls/35009. 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. |
|
|
|
|
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. |
|
Did some further thinking on transaction listing, and I no longer thing this is the right approach. Change is not a logical transaction and should not be shown in |
|
If I interpret @achow101's latest comment correctly, this pull request and its related two issues should probably be closed, no? |
7c311f5 doc: Add release notes for listrawtransactions (pablomartin4btc) b377786 test: Add functional test for listrawtransactions (pablomartin4btc) 605c4fd wallet, rpc: Add listrawtransactions RPC (pablomartin4btc) ba6c179 wallet, rpc: allow omitting parent_descs from TransactionDescriptionString (pablomartin4btc) dc3e2bc wallet, rpc: extract PushTxAmountAndFee/PushTxDecoded helpers (pablomartin4btc) Pull request description: Add a new `listrawtransactions` RPC that returns wallet transactions without logical interpretation. Unlike `listtransactions`, which only lists transactions with an economic category (sends to external addresses, receives from outside), this RPC returns every transaction the wallet knows about — including consolidations and self-transfers that would otherwise be invisible. Each transaction appears exactly once with its net wallet balance change (`amount`) and, when the wallet funded the transaction, the fee paid (`fee`). Pagination is supported via `count` and `skip` parameters, matching the interface of `listtransactions`. Next possible follow-ups: - A filter parameter (`"all"` / `"received"` / `"sent"` / `"self"`) once per-tx semantics are agreed on - Some fields inherited from `TransactionDescriptionString()` carry references to `category` (e.g. `replaced_by_txid`, `parent_descs`) which don't apply here — could be cleaned up in a separate pass Closes #34632. Previous attempt: #35009 (by alfonsoromanz), closed in favour of a separate RPC as suggested by achow101. ACKs for top commit: Bicaru20: reACK 7c311f5 achow101: ACK 7c311f5 polespinasa: ACK 7c311f5 Tree-SHA512: c80f98844124d10b16a7f275107e22d4f5983329d93208e95b3e56ac7295c7265eebdb247a4fa7d70da8d38f4b453df17efaee29a4bd6bae8cb1da60b029c489
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