aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAnthony Towns <aj@erisian.com.au>2019-05-30 14:02:41 +1000
committerAnthony Towns <aj@erisian.com.au>2020-05-19 16:33:02 +1000
commitde7c5f41aba860751ef7824245e6d9d5088a1200 (patch)
treefbf12cfa5fe55d0f21dcaf57e7b510327b1ab296
parentc3cf2f55013c4ea1c1ef4a878fc7ff8e92f2c42d (diff)
wallet/wallet.h: Remove mutexScanning which was only protecting a single atomic bool
-rw-r--r--src/wallet/wallet.h6
1 files changed, 1 insertions, 5 deletions
diff --git a/src/wallet/wallet.h b/src/wallet/wallet.h
index 8f624c25d7..a4cb8253d3 100644
--- a/src/wallet/wallet.h
+++ b/src/wallet/wallet.h
@@ -631,7 +631,6 @@ private:
std::atomic<bool> fScanningWallet{false}; // controlled by WalletRescanReserver
std::atomic<int64_t> m_scanning_start{0};
std::atomic<double> m_scanning_progress{0};
- std::mutex mutexScanning;
friend class WalletRescanReserver;
//! the current wallet version: clients below this version are not able to load the wallet
@@ -1286,13 +1285,11 @@ public:
bool reserve()
{
assert(!m_could_reserve);
- std::lock_guard<std::mutex> lock(m_wallet.mutexScanning);
- if (m_wallet.fScanningWallet) {
+ if (m_wallet.fScanningWallet.exchange(true)) {
return false;
}
m_wallet.m_scanning_start = GetTimeMillis();
m_wallet.m_scanning_progress = 0;
- m_wallet.fScanningWallet = true;
m_could_reserve = true;
return true;
}
@@ -1304,7 +1301,6 @@ public:
~WalletRescanReserver()
{
- std::lock_guard<std::mutex> lock(m_wallet.mutexScanning);
if (m_could_reserve) {
m_wallet.fScanningWallet = false;
}