rpc: Allow importprunedfunds to import spending transactions #34485

pull BuilderFred wants to merge 2 commits into bitcoin:master from BuilderFred:fix-importprunedfunds changing 3 files +73 −2
  1. BuilderFred commented at 4:13 pm on February 2, 2026: none

    Motivation

    importprunedfunds previously only allowed importing transactions that credit the wallet (IsMine check). This prevented users from importing transactions that spend funds from the wallet if the transaction had no outputs belonging to the wallet (e.g. sending entire balance to an external address).

    Users typically want to import spending transactions to correctly reflect the debit and update the balance/history in a pruned wallet.

    Fixes #21647.

    Solution

    Updated importprunedfunds in src/wallet/rpc/backup.cpp to check pwallet->IsFromMe(*tx_ref) in addition to pwallet->IsMine(*tx_ref).

    Testing

    Added a regression test case in test/functional/wallet_importprunedfunds.py that:

    1. Funds a wallet address.
    2. Sends the entire balance to an external address (creating a spending transaction with no change output).
    3. Removes the transaction.
    4. Verifies that importprunedfunds can successfully re-import this spending transaction.
  2. net: Enable local address discovery when bind=0.0.0.0 is used 227ed708ca
  3. rpc: Allow importprunedfunds to import spending transactions d1c9959f18
  4. DrahtBot added the label RPC/REST/ZMQ on Feb 2, 2026
  5. DrahtBot commented at 4:14 pm on February 2, 2026: contributor

    The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.

    Reviews

    See the guideline for information on the review process. A summary of reviews will appear here.

  6. fanquake commented at 4:15 pm on February 2, 2026: member
    Dupe of #34371.
  7. fanquake closed this on Feb 2, 2026


github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2026-02-22 00:13 UTC

This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me