Skip to content

Commit

Permalink
refactor: drop isEnforced; only use isEnabled
Browse files Browse the repository at this point in the history
  • Loading branch information
PastaPastaPasta committed Feb 16, 2024
1 parent 0bdfbf9 commit bbf3e37
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 7 deletions.
11 changes: 5 additions & 6 deletions src/llmq/chainlocks.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -219,11 +219,10 @@ void CChainLocksHandler::UpdatedBlockTip()

void CChainLocksHandler::CheckActiveState()
{
bool oldIsEnforced = isEnforced;
bool oldIsEnabled = isEnabled;
isEnabled = AreChainLocksEnabled(spork_manager);
isEnforced = isEnabled.load();

if (!oldIsEnforced && isEnforced) {
if (!oldIsEnabled && isEnabled) {
// ChainLocks got activated just recently, but it's possible that it was already running before, leaving
// us with some stale values which we should not try to enforce anymore (there probably was a good reason
// to disable spork19)
Expand Down Expand Up @@ -475,7 +474,7 @@ void CChainLocksHandler::EnforceBestChainLock()
{
LOCK(cs);

if (!isEnforced) {
if (!isEnabled) {
return;
}

Expand Down Expand Up @@ -561,7 +560,7 @@ bool CChainLocksHandler::InternalHasChainLock(int nHeight, const uint256& blockH
{
AssertLockHeld(cs);

if (!isEnforced) {
if (!isEnabled) {
return false;
}

Expand Down Expand Up @@ -591,7 +590,7 @@ bool CChainLocksHandler::InternalHasConflictingChainLock(int nHeight, const uint
{
AssertLockHeld(cs);

if (!isEnforced) {
if (!isEnabled) {
return false;
}

Expand Down
1 change: 0 additions & 1 deletion src/llmq/chainlocks.h
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,6 @@ class CChainLocksHandler : public CRecoveredSigsListener
mutable Mutex cs;
std::atomic<bool> tryLockChainTipScheduled{false};
std::atomic<bool> isEnabled{false};
std::atomic<bool> isEnforced{false};

uint256 bestChainLockHash GUARDED_BY(cs);
CChainLockSig bestChainLock GUARDED_BY(cs);
Expand Down

0 comments on commit bbf3e37

Please sign in to comment.