mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-02-01 03:01:05 +00:00
wallet: Recalculate the wallet's txos after any imports
This commit is contained in:
parent
ae888c38d0
commit
96e7a89c5e
@ -250,6 +250,7 @@ RPCHelpMan keypoolrefill()
|
||||
if (pwallet->GetKeyPoolSize() < kpSize) {
|
||||
throw JSONRPCError(RPC_WALLET_ERROR, "Error refreshing keypool.");
|
||||
}
|
||||
pwallet->RefreshAllTXOs();
|
||||
|
||||
return UniValue::VNULL;
|
||||
},
|
||||
|
||||
@ -394,6 +394,7 @@ RPCHelpMan importdescriptors()
|
||||
}
|
||||
}
|
||||
pwallet->ConnectScriptPubKeyManNotifiers();
|
||||
pwallet->RefreshAllTXOs();
|
||||
}
|
||||
|
||||
// Rescan the blockchain using the lowest timestamp
|
||||
|
||||
@ -4451,4 +4451,12 @@ void CWallet::RefreshTXOsFromTx(const CWalletTx& wtx)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void CWallet::RefreshAllTXOs()
|
||||
{
|
||||
AssertLockHeld(cs_wallet);
|
||||
for (const auto& [_, wtx] : mapWallet) {
|
||||
RefreshTXOsFromTx(wtx);
|
||||
}
|
||||
}
|
||||
} // namespace wallet
|
||||
|
||||
@ -525,6 +525,8 @@ public:
|
||||
|
||||
/** Cache outputs that belong to the wallet from a single transaction */
|
||||
void RefreshTXOsFromTx(const CWalletTx& wtx) EXCLUSIVE_LOCKS_REQUIRED(cs_wallet);
|
||||
/** Cache outputs that belong to the wallet for all transactions in the wallet */
|
||||
void RefreshAllTXOs() EXCLUSIVE_LOCKS_REQUIRED(cs_wallet);
|
||||
|
||||
/**
|
||||
* Return depth of transaction in blockchain:
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user