Skip to content

Commit

Permalink
net: if we are a MN, don't accept incoming connections until the node…
Browse files Browse the repository at this point in the history
… is fully synced.
  • Loading branch information
furszy committed Jan 12, 2022
1 parent e7e44f1 commit 026ec74
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/net.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
#include "primitives/transaction.h"
#include "scheduler.h"
#include "tiertwo/net_masternodes.h"
#include "tiertwo/tiertwo_sync_state.h"
#include "validation.h"

#ifdef WIN32
Expand Down Expand Up @@ -1111,6 +1112,13 @@ void CConnman::AcceptConnection(const ListenSocket& hListenSocket) {
return;
}

// if we are a MN, don't accept incoming connections until fully synced
if (fMasterNode && !g_tiertwo_sync_state.IsSynced()) {
LogPrint(BCLog::NET, "AcceptConnection -- masternode is not synced yet, skipping inbound connection attempt\n");
CloseSocket(hSocket);
return;
}

// TODO: pending review.
// Evict connections until we are below nMaxInbound. In case eviction protection resulted in nodes to not be evicted
// before, they might get evicted in batches now (after the protection timeout).
Expand Down

0 comments on commit 026ec74

Please sign in to comment.