Skip to content

Commit 1c7e25d

Browse files
wallet: Add missing locks
1 parent 1d14174 commit 1c7e25d

File tree

2 files changed

+3
-2
lines changed

2 files changed

+3
-2
lines changed

src/wallet/test/psbt_wallet_tests.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ BOOST_FIXTURE_TEST_SUITE(psbt_wallet_tests, WalletTestingSetup)
1717

1818
BOOST_AUTO_TEST_CASE(psbt_updater_test)
1919
{
20+
LOCK(m_wallet.cs_wallet);
21+
2022
// Create prevtxs and add to wallet
2123
CDataStream s_prev_tx1(ParseHex("0200000000010158e87a21b56daf0c23be8e7070456c336f7cbaa5c8757924f545887bb2abdd7501000000171600145f275f436b09a8cc9a2eb2a2f528485c68a56323feffffff02d8231f1b0100000017a914aed962d6654f9a2b36608eb9d64d2b260db4f1118700c2eb0b0000000017a914b7f5faf40e3d40a5a459b1db3535f2b72fa921e88702483045022100a22edcc6e5bc511af4cc4ae0de0fcd75c7e04d8c1c3a8aa9d820ed4b967384ec02200642963597b9b1bc22c75e9f3e117284a962188bf5e8a74c895089046a20ad770121035509a48eb623e10aace8bfd0212fdb8a8e5af3c94b0b133b95e114cab89e4f7965000000"), SER_NETWORK, PROTOCOL_VERSION);
2224
CTransactionRef prev_tx1;

src/wallet/wallet.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4093,7 +4093,7 @@ std::shared_ptr<CWallet> CWallet::CreateWalletFromFile(const std::string& name,
40934093
// Try to top up keypool. No-op if the wallet is locked.
40944094
walletInstance->TopUpKeyPool();
40954095

4096-
LOCK(cs_main);
4096+
LOCK2(cs_main, walletInstance->cs_wallet);
40974097

40984098
CBlockIndex *pindexRescan = chainActive.Genesis();
40994099
if (!gArgs.GetBoolArg("-rescan", false))
@@ -4178,7 +4178,6 @@ std::shared_ptr<CWallet> CWallet::CreateWalletFromFile(const std::string& name,
41784178
walletInstance->SetBroadcastTransactions(gArgs.GetBoolArg("-walletbroadcast", DEFAULT_WALLETBROADCAST));
41794179

41804180
{
4181-
LOCK(walletInstance->cs_wallet);
41824181
walletInstance->WalletLogPrintf("setKeyPool.size() = %u\n", walletInstance->GetKeyPoolSize());
41834182
walletInstance->WalletLogPrintf("mapWallet.size() = %u\n", walletInstance->mapWallet.size());
41844183
walletInstance->WalletLogPrintf("mapAddressBook.size() = %u\n", walletInstance->mapAddressBook.size());

0 commit comments

Comments
 (0)