Issue Details

Number
21647
Title
RPC importprunedfunds doesn't allow importing spending txs, only receiving txs
Description
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; }
URL
https://github.com/bitcoin/bitcoin/issue/21647
Closed by
Back to List