Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

V0.12.0.x fix mnb ping acceptance #446

Merged
merged 1 commit into from
Jul 20, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions src/masternode.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ void CMasternode::UpdateFromNewBroadcast(CMasternodeBroadcast& mnb)
protocolVersion = mnb.protocolVersion;
addr = mnb.addr;
int nDoS = 0;
if(mnb.lastPing == CMasternodePing() || (mnb.lastPing != CMasternodePing() && mnb.lastPing.CheckAndUpdate(nDoS))) {
if(mnb.lastPing == CMasternodePing() || (mnb.lastPing != CMasternodePing() && mnb.lastPing.CheckAndUpdate(nDoS, false))) {
lastPing = mnb.lastPing;
mapSeenMasternodePing[lastPing.GetHash()] = lastPing;
}
Expand Down Expand Up @@ -500,7 +500,7 @@ bool CMasternodePing::Sign(CKey& keyMasternode, CPubKey& pubKeyMasternode)
return true;
}

bool CMasternodePing::CheckAndUpdate(int& nDos)
bool CMasternodePing::CheckAndUpdate(int& nDos, bool fRequireEnabled)
{
if (sigTime > GetAdjustedTime() + 60 * 60) {
LogPrintf("CMasternodePing::CheckAndUpdate - Signature rejected, too far into the future %s\n", vin.ToString().c_str());
Expand All @@ -516,7 +516,8 @@ bool CMasternodePing::CheckAndUpdate(int& nDos)

// see if we have this Masternode
CMasternode* pmn = mnodeman.Find(vin);
if(pmn != NULL && pmn->IsEnabled() && pmn->protocolVersion >= masternodePayments.GetMinMasternodePaymentsProto())
fRequireEnabled = (fRequireEnabled && pmn->IsEnabled()) || !fRequireEnabled;
if(pmn != NULL && fRequireEnabled && pmn->protocolVersion >= masternodePayments.GetMinMasternodePaymentsProto())
{
// LogPrintf("mnping - Found corresponding mn for vin: %s\n", vin.ToString().c_str());
// update only if there is no known ping for this masternode or
Expand Down
2 changes: 1 addition & 1 deletion src/masternode.h
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ class CMasternodePing
READWRITE(vchSig);
}

bool CheckAndUpdate(int& nDos);
bool CheckAndUpdate(int& nDos, bool fRequireEnabled = true);
bool Sign(CKey& keyMasternode, CPubKey& pubKeyMasternode);
void Relay();

Expand Down