refactor: move ScopedLockBool from header to cpp file

This commit is contained in:
Konstantin Akimov 2024-09-26 02:30:52 +07:00
parent 7aafb5a393
commit 1570a02c89
No known key found for this signature in database
GPG Key ID: 2176C4A5D01EA524
2 changed files with 19 additions and 20 deletions

View File

@ -33,6 +33,25 @@ const std::string GovernanceStore::SERIALIZATION_VERSION_STRING = "CGovernanceMa
const int CGovernanceManager::MAX_TIME_FUTURE_DEVIATION = 60 * 60;
const int CGovernanceManager::RELIABLE_PROPAGATION_TIME = 60;
namespace {
class ScopedLockBool
{
bool& ref;
bool fPrevValue;
public:
ScopedLockBool(RecursiveMutex& _cs, bool& _ref, bool _value) :
ref(_ref)
{
AssertLockHeld(_cs);
fPrevValue = ref;
ref = _value;
}
~ScopedLockBool() { ref = fPrevValue; }
};
} // anonymous namespace
GovernanceStore::GovernanceStore() :
cs(),
mapObjects(),

View File

@ -231,26 +231,6 @@ private:
using hash_s_t = std::set<uint256>;
using db_type = CFlatDB<GovernanceStore>;
class ScopedLockBool
{
bool& ref;
bool fPrevValue;
public:
ScopedLockBool(RecursiveMutex& _cs, bool& _ref, bool _value) :
ref(_ref)
{
AssertLockHeld(_cs);
fPrevValue = ref;
ref = _value;
}
~ScopedLockBool()
{
ref = fPrevValue;
}
};
private:
static const int MAX_TIME_FUTURE_DEVIATION;
static const int RELIABLE_PROPAGATION_TIME;