Skip to content

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

Closed

Description

@dooglus

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;
     }

Activity

  1. changed the title [-]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
  2. jamesob commented on Jan 3, 2022

    @jamesob
    Contributor

    @dooglus any interest in making a PR for this? The "good first issue" label might apply here.

  3. dooglus commented on Jan 4, 2022

    @dooglus
    ContributorAuthor

    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.

  4. crackedhandle commented on Jan 20, 2026

    @crackedhandle

    I’d like to work on this. Is anyone currently working on it?

  5. ShirshenduR commented on Feb 13, 2026

    @ShirshenduR

    @dooglus Can i work on this issue and raise PR

  6. varunnaikr commented on Feb 14, 2026

    @varunnaikr

    Hi, I am a Summer of Bitcoin 2026 applicant.
    I would like to work on this issue.
    Can I take this up?

  7. Mterra64 commented on Feb 16, 2026

    @Mterra64

    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.

  8. added a commit that references this issue on Sep 25, 2026
    ed7dd7c
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions