Skip to content

Commit 026ec74

Browse files
committed
net: if we are a MN, don't accept incoming connections until the node is fully synced.
1 parent e7e44f1 commit 026ec74

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

src/net.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
#include "primitives/transaction.h"
2424
#include "scheduler.h"
2525
#include "tiertwo/net_masternodes.h"
26+
#include "tiertwo/tiertwo_sync_state.h"
2627
#include "validation.h"
2728

2829
#ifdef WIN32
@@ -1111,6 +1112,13 @@ void CConnman::AcceptConnection(const ListenSocket& hListenSocket) {
11111112
return;
11121113
}
11131114

1115+
// if we are a MN, don't accept incoming connections until fully synced
1116+
if (fMasterNode && !g_tiertwo_sync_state.IsSynced()) {
1117+
LogPrint(BCLog::NET, "AcceptConnection -- masternode is not synced yet, skipping inbound connection attempt\n");
1118+
CloseSocket(hSocket);
1119+
return;
1120+
}
1121+
11141122
// TODO: pending review.
11151123
// Evict connections until we are below nMaxInbound. In case eviction protection resulted in nodes to not be evicted
11161124
// before, they might get evicted in batches now (after the protection timeout).

0 commit comments

Comments
 (0)