mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-07-23 14:48:55 +02:00
wallet: reserve walletrescan before checking wallet is at the tip
This commit is contained in:
@@ -380,15 +380,15 @@ RPCMethod importdescriptors()
|
||||
if (!pwallet) return UniValue::VNULL;
|
||||
CWallet& wallet{*pwallet};
|
||||
|
||||
// Make sure the results are valid at least up to the most recent block
|
||||
// the user could have gotten from another RPC command prior to now
|
||||
wallet.BlockUntilSyncedToCurrentChain();
|
||||
|
||||
WalletRescanReserver reserver(*pwallet);
|
||||
if (!reserver.reserve(/*with_passphrase=*/true)) {
|
||||
throw JSONRPCError(RPC_WALLET_ERROR, "Wallet is currently rescanning. Abort existing rescan or wait.");
|
||||
}
|
||||
|
||||
// Make sure the results are valid at least up to the most recent block
|
||||
// the user could have gotten from another RPC command prior to now
|
||||
wallet.BlockUntilSyncedToCurrentChain();
|
||||
|
||||
// Ensure that the wallet is not locked for the remainder of this RPC, as
|
||||
// the passphrase is used to top up the keypool.
|
||||
LOCK(pwallet->m_relock_mutex);
|
||||
|
||||
Reference in New Issue
Block a user