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?

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-01-22 09:13 UTC

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