From 1570a02c89b21694fd08bdc0a2711720578be409 Mon Sep 17 00:00:00 2001 From: Konstantin Akimov Date: Thu, 26 Sep 2024 02:30:52 +0700 Subject: [PATCH] refactor: move ScopedLockBool from header to cpp file --- src/governance/governance.cpp | 19 +++++++++++++++++++ src/governance/governance.h | 20 -------------------- 2 files changed, 19 insertions(+), 20 deletions(-) diff --git a/src/governance/governance.cpp b/src/governance/governance.cpp index 00a130e7d1..b9310a4480 100644 --- a/src/governance/governance.cpp +++ b/src/governance/governance.cpp @@ -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(), diff --git a/src/governance/governance.h b/src/governance/governance.h index 100e303d13..f9fe3c2e1f 100644 --- a/src/governance/governance.h +++ b/src/governance/governance.h @@ -231,26 +231,6 @@ private: using hash_s_t = std::set; using db_type = CFlatDB; - 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;