mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-03-05 14:06:27 -05:00
wallet/wallet.h: Remove mutexScanning which was only protecting a single atomic bool
This commit is contained in:
parent
c3cf2f5501
commit
de7c5f41ab
1 changed files with 1 additions and 5 deletions
|
@ -631,7 +631,6 @@ private:
|
||||||
std::atomic<bool> fScanningWallet{false}; // controlled by WalletRescanReserver
|
std::atomic<bool> fScanningWallet{false}; // controlled by WalletRescanReserver
|
||||||
std::atomic<int64_t> m_scanning_start{0};
|
std::atomic<int64_t> m_scanning_start{0};
|
||||||
std::atomic<double> m_scanning_progress{0};
|
std::atomic<double> m_scanning_progress{0};
|
||||||
std::mutex mutexScanning;
|
|
||||||
friend class WalletRescanReserver;
|
friend class WalletRescanReserver;
|
||||||
|
|
||||||
//! the current wallet version: clients below this version are not able to load the wallet
|
//! the current wallet version: clients below this version are not able to load the wallet
|
||||||
|
@ -1286,13 +1285,11 @@ public:
|
||||||
bool reserve()
|
bool reserve()
|
||||||
{
|
{
|
||||||
assert(!m_could_reserve);
|
assert(!m_could_reserve);
|
||||||
std::lock_guard<std::mutex> lock(m_wallet.mutexScanning);
|
if (m_wallet.fScanningWallet.exchange(true)) {
|
||||||
if (m_wallet.fScanningWallet) {
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
m_wallet.m_scanning_start = GetTimeMillis();
|
m_wallet.m_scanning_start = GetTimeMillis();
|
||||||
m_wallet.m_scanning_progress = 0;
|
m_wallet.m_scanning_progress = 0;
|
||||||
m_wallet.fScanningWallet = true;
|
|
||||||
m_could_reserve = true;
|
m_could_reserve = true;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -1304,7 +1301,6 @@ public:
|
||||||
|
|
||||||
~WalletRescanReserver()
|
~WalletRescanReserver()
|
||||||
{
|
{
|
||||||
std::lock_guard<std::mutex> lock(m_wallet.mutexScanning);
|
|
||||||
if (m_could_reserve) {
|
if (m_could_reserve) {
|
||||||
m_wallet.fScanningWallet = false;
|
m_wallet.fScanningWallet = false;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue