Skip to content

Commit 2e3e313

Browse files
committed
Solving a dead end inconsistency over the masternode activation process.
A valid masternode is created, mn start message is broadcasted and the entire network receives it. Peers move the masternode status to pre_enable (active) and are waiting for a mn ping update to fulfill the min ping time requirement after it activation to move to enable. Issue: As the mnping update message work flow is not performing any action until the masternode is in enable status (masternode.cpp, line 707), the masternode ping is never updated, there by the masternode will never be moved to enable status.
1 parent 7196a35 commit 2e3e313

File tree

2 files changed

+10
-1
lines changed

2 files changed

+10
-1
lines changed

src/masternode.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -704,7 +704,11 @@ bool CMasternodePing::CheckAndUpdate(int& nDos, bool fRequireEnabled, bool fChec
704704
LogPrint(BCLog::MNPING, "%s: New Ping - %s - %s - %lli\n", __func__, GetHash().ToString(), blockHash.ToString(), sigTime);
705705

706706
if (isMasternodeFound && pmn->protocolVersion >= ActiveProtocol()) {
707-
if (fRequireEnabled && !pmn->IsEnabled()) return false;
707+
708+
// Update ping only if the masternode is active/enabled
709+
if (fRequireEnabled && (!pmn->IsEnabled() && !pmn->IsPreEnabled())) {
710+
return false;
711+
}
708712

709713
// update only if there is no known ping for this masternode or
710714
// last ping was more then MASTERNODE_MIN_MNP_SECONDS-60 ago comparing to this one

src/masternode.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -244,6 +244,11 @@ class CMasternode : public CSignedMessage
244244
return WITH_LOCK(cs, return activeState == MASTERNODE_ENABLED);
245245
}
246246

247+
bool IsPreEnabled()
248+
{
249+
return WITH_LOCK(cs, return activeState == MASTERNODE_PRE_ENABLED );
250+
}
251+
247252
std::string Status()
248253
{
249254
std::string strStatus = "ACTIVE";

0 commit comments

Comments
 (0)