mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-03-31 10:56:03 +02:00
wallet: Recalculate the wallet's txos after any imports
This commit is contained in:
@@ -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:
|
||||
|
||||
Reference in New Issue
Block a user