Skip to content

Commit

Permalink
mnsync: decouple IsBlockchainSync into a publicly available g_tiertwo…
Browse files Browse the repository at this point in the history
…_sync_state class which only stores the final value.
  • Loading branch information
furszy committed Jan 17, 2022
1 parent 038191c commit 6015d90
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
6 changes: 4 additions & 2 deletions src/evo/mnauth.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,14 @@

#include "activemasternode.h"
#include "chainparams.h"
#include "masternode-sync.h" // for IsBlockchainSynced
#include "consensus/validation.h"
#include "tiertwo/masternode_meta_manager.h"
#include "netmessagemaker.h"
#include "llmq/quorums_utils.h"
#include "util/system.h" // for fMasternode and gArgs access
#include "tiertwo/net_masternodes.h"
#include "tiertwo/tiertwo_sync_state.h"

#include "version.h" // for MNAUTH_NODE_VER_VERSION

void CMNAuth::PushMNAUTH(CNode* pnode, CConnman& connman)
Expand Down Expand Up @@ -56,7 +58,7 @@ void CMNAuth::PushMNAUTH(CNode* pnode, CConnman& connman)

bool CMNAuth::ProcessMessage(CNode* pnode, const std::string& strCommand, CDataStream& vRecv, CConnman& connman, CValidationState& state)
{
if (!masternodeSync.IsBlockchainSynced()) {
if (!g_tiertwo_sync_state.IsBlockchainSynced()) {
// we can't verify MNAUTH messages when we don't have the latest MN list
return true;
}
Expand Down
6 changes: 3 additions & 3 deletions src/tiertwo/net_masternodes.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
#include "evo/deterministicmns.h"
#include "scheduler.h"
#include "tiertwo/masternode_meta_manager.h" // for g_mmetaman
#include "masternode-sync.h" // for IsBlockchainSynced
#include "tiertwo/tiertwo_sync_state.h"
#include "netmessagemaker.h"

TierTwoConnMan::TierTwoConnMan(CConnman* _connman) : connman(_connman) {}
Expand Down Expand Up @@ -188,7 +188,7 @@ void TierTwoConnMan::ThreadOpenMasternodeConnections()
triedConnect = false;

// todo: add !fNetworkActive
if (!masternodeSync.IsBlockchainSynced()) {
if (!g_tiertwo_sync_state.IsBlockchainSynced()) {
continue;
}

Expand Down Expand Up @@ -372,7 +372,7 @@ static void ProcessMasternodeConnections(CConnman& connman, TierTwoConnMan& tier

void TierTwoConnMan::doMaintenance()
{
if(!masternodeSync.IsBlockchainSynced() || interruptNet) {
if(!g_tiertwo_sync_state.IsBlockchainSynced() || interruptNet) {
return;
}
ProcessMasternodeConnections(*connman, *this);
Expand Down

0 comments on commit 6015d90

Please sign in to comment.