RPC importprunedfunds doesn’t allow importing spending txs, only receiving txs #21647

issue dooglus openend this issue on April 10, 2021
  1. dooglus commented at 0:36 am on April 10, 2021: contributor

    I noticed one of my wallets shows that I own funds that I really don’t. I identified the spending transaction and tried to import it using ‘importprunedfunds’ but was told:

    No addresses in wallet correspond to included transaction

    It turns out that ‘importprunedfunds’ only allows you to import txs which credit an address owned by your wallet. It won’t let you import txs which spend from addresses owned by your wallet.

    I made the following change and then was able to import the missing transaction:

    --- a/src/wallet/rpcdump.cpp
    +++ b/src/wallet/rpcdump.cpp
    @@ -372,7 +372,7 @@ RPCHelpMan importprunedfunds()
         CWalletTx::Confirmation confirm(CWalletTx::Status::CONFIRMED, height, merkleBlock.header.GetHash(), txnIndex);
     
         CTransactionRef tx_ref = MakeTransactionRef(tx);
    -    if (pwallet->IsMine(*tx_ref)) {
    +    if (pwallet->IsMine(*tx_ref) || pwallet->IsFromMe(*tx_ref)) {
             pwallet->AddToWallet(std::move(tx_ref), confirm);
             return NullUniValue;
         }
    
  2. dooglus renamed this:
    RPC importprunedfunds doesn't allo importing spending txs, only receiving txs
    RPC importprunedfunds doesn't allow importing spending txs, only receiving txs
    on Apr 10, 2021
  3. ghost commented at 9:15 pm on April 11, 2021: none

    I noticed one of my wallets shows that I own funds that I really don’t.

    How can I reproduce it?

    It turns out that ‘importprunedfunds’ only allows you to import txs which credit an address owned by your wallet. It won’t let you import txs which spend from addresses owned by your wallet.

    Sounds interesting and also never used this RPC command. Reading the things mentioned here: https://bitcoincore.org/en/doc/0.21.0/rpc/wallet/importprunedfunds/ still not sure when does this help users.

    I made the following change and then was able to import the missing transaction:

    If this resolves the issue and doesn’t break anything else, maybe a PR can be created for it?

  4. jamesob commented at 7:06 pm on January 3, 2022: contributor
    @dooglus any interest in making a PR for this? The “good first issue” label might apply here.
  5. dooglus commented at 6:10 pm on January 4, 2022: contributor

    I’ve not had much luck making PRs. I don’t have enough energy to fight for them to be reviewed and merged. I hope this issue makes the problem and the solution clear enough that anyone interested can fix it.

    If the “good first issue” label might help please feel free to apply it.

  6. willcl-ark added the label Wallet on Jan 16, 2026
  7. willcl-ark added the label RPC/REST/ZMQ on Jan 16, 2026
  8. willcl-ark added the label good first issue on Jan 16, 2026
  9. crackedhandle commented at 7:49 am on January 20, 2026: none
    I’d like to work on this. Is anyone currently working on it?
  10. 8144225309 referenced this in commit af80d2c367 on Jan 21, 2026
  11. 8144225309 referenced this in commit 13b880a5aa on Jan 27, 2026
  12. maflcko removed the label good first issue on Feb 12, 2026
  13. maflcko added the label good first issue on Feb 12, 2026
  14. ShirshenduR commented at 6:33 pm on February 13, 2026: none
    @dooglus Can i work on this issue and raise PR
  15. varunnaikr commented at 9:28 am on February 14, 2026: none
    Hi, I am a Summer of Bitcoin 2026 applicant. I would like to work on this issue. Can I take this up?
  16. Mterra64 commented at 3:06 am on February 16, 2026: none

    I have been reviewing this issue to better understand the current behavior of the importprunedfunds RPC.

    From what I understand, the RPC currently allows importing receiving transactions but does not support importing spending transactions. This seems to create an incomplete wallet state representation, especially in scenarios where pruned nodes need to reconstruct historical wallet activity.

    Would extending support to spending transactions require additional validation logic to ensure consistency with existing UTXO tracking and wallet state management?

    I am currently exploring how wallet transaction metadata is handled internally, particularly how imported transactions are reconciled with the UTXO set.

    Any clarification on the intended architectural constraints around importprunedfunds would be very helpful.

  17. maflcko removed the label good first issue on Feb 16, 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-03-04 00:13 UTC

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