Skip to content

Commit de7c5f4

Browse files
committed
wallet/wallet.h: Remove mutexScanning which was only protecting a single atomic bool
1 parent c3cf2f5 commit de7c5f4

File tree

1 file changed

+1
-5
lines changed

1 file changed

+1
-5
lines changed

src/wallet/wallet.h

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -631,7 +631,6 @@ class CWallet final : public WalletStorage, public interfaces::Chain::Notificati
631631
std::atomic<bool> fScanningWallet{false}; // controlled by WalletRescanReserver
632632
std::atomic<int64_t> m_scanning_start{0};
633633
std::atomic<double> m_scanning_progress{0};
634-
std::mutex mutexScanning;
635634
friend class WalletRescanReserver;
636635

637636
//! the current wallet version: clients below this version are not able to load the wallet
@@ -1286,13 +1285,11 @@ class WalletRescanReserver
12861285
bool reserve()
12871286
{
12881287
assert(!m_could_reserve);
1289-
std::lock_guard<std::mutex> lock(m_wallet.mutexScanning);
1290-
if (m_wallet.fScanningWallet) {
1288+
if (m_wallet.fScanningWallet.exchange(true)) {
12911289
return false;
12921290
}
12931291
m_wallet.m_scanning_start = GetTimeMillis();
12941292
m_wallet.m_scanning_progress = 0;
1295-
m_wallet.fScanningWallet = true;
12961293
m_could_reserve = true;
12971294
return true;
12981295
}
@@ -1304,7 +1301,6 @@ class WalletRescanReserver
13041301

13051302
~WalletRescanReserver()
13061303
{
1307-
std::lock_guard<std::mutex> lock(m_wallet.mutexScanning);
13081304
if (m_could_reserve) {
13091305
m_wallet.fScanningWallet = false;
13101306
}

0 commit comments

Comments
 (0)