wallet: Call load handlers without cs_wallet locked

Co-authored-by: Russell Yanofsky <russ@yanofsky.org>
This commit is contained in:
João Barbosa
2021-09-02 23:11:50 +01:00
parent 47fe7445e7
commit f13a22a631
3 changed files with 5 additions and 9 deletions

View File

@ -2759,8 +2759,6 @@ std::shared_ptr<CWallet> CWallet::Create(WalletContext& context, const std::stri
// Try to top up keypool. No-op if the wallet is locked.
walletInstance->TopUpKeyPool();
LOCK(walletInstance->cs_wallet);
if (chain && !AttachChain(walletInstance, *chain, rescan_required, error, warnings)) {
return nullptr;
}
@ -2772,9 +2770,9 @@ std::shared_ptr<CWallet> CWallet::Create(WalletContext& context, const std::stri
}
}
walletInstance->SetBroadcastTransactions(args.GetBoolArg("-walletbroadcast", DEFAULT_WALLETBROADCAST));
{
LOCK(walletInstance->cs_wallet);
walletInstance->SetBroadcastTransactions(args.GetBoolArg("-walletbroadcast", DEFAULT_WALLETBROADCAST));
walletInstance->WalletLogPrintf("setKeyPool.size() = %u\n", walletInstance->GetKeyPoolSize());
walletInstance->WalletLogPrintf("mapWallet.size() = %u\n", walletInstance->mapWallet.size());
walletInstance->WalletLogPrintf("m_address_book.size() = %u\n", walletInstance->m_address_book.size());