fix excessive banning, remove some redundant logic (#1172)
* Since we send all mnb's now regardless of mn state, ping check for sigTime being too old is obsolete (and wrong). Also removing fRequireEnabled, this logic is deprecated too it seems. * remove (pre-)enabled check in CMasternodeMan::Add
This commit is contained in:
parent
6cd6722c08
commit
17cebbed15
@ -121,7 +121,7 @@ bool CMasternode::UpdateFromNewBroadcast(CMasternodeBroadcast& mnb)
|
||||
nTimeLastChecked = 0;
|
||||
nTimeLastWatchdogVote = mnb.sigTime;
|
||||
int nDos = 0;
|
||||
if(mnb.lastPing == CMasternodePing() || (mnb.lastPing != CMasternodePing() && mnb.lastPing.CheckAndUpdate(nDos, false))) {
|
||||
if(mnb.lastPing == CMasternodePing() || (mnb.lastPing != CMasternodePing() && mnb.lastPing.CheckAndUpdate(nDos))) {
|
||||
lastPing = mnb.lastPing;
|
||||
mnodeman.mapSeenMasternodePing.insert(std::make_pair(lastPing.GetHash(), lastPing));
|
||||
}
|
||||
@ -466,7 +466,7 @@ bool CMasternodeBroadcast::SimpleCheck(int& nDos)
|
||||
}
|
||||
|
||||
// empty ping or incorrect sigTime/blockhash
|
||||
if(lastPing == CMasternodePing() || !lastPing.CheckAndUpdate(nDos, false, true)) {
|
||||
if(lastPing == CMasternodePing() || !lastPing.CheckAndUpdate(nDos, true)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -765,7 +765,7 @@ bool CMasternodePing::CheckSignature(CPubKey& pubKeyMasternode, int &nDos)
|
||||
return true;
|
||||
}
|
||||
|
||||
bool CMasternodePing::CheckAndUpdate(int& nDos, bool fRequireEnabled, bool fSimpleCheck)
|
||||
bool CMasternodePing::CheckAndUpdate(int& nDos, bool fSimpleCheck)
|
||||
{
|
||||
if (sigTime > GetAdjustedTime() + 60 * 60) {
|
||||
LogPrintf("CMasternodePing::CheckAndUpdate -- Signature rejected, too far into the future, masternode=%s\n", vin.prevout.ToStringShort());
|
||||
@ -773,12 +773,6 @@ bool CMasternodePing::CheckAndUpdate(int& nDos, bool fRequireEnabled, bool fSimp
|
||||
return false;
|
||||
}
|
||||
|
||||
if (sigTime <= GetAdjustedTime() - 60 * 60) {
|
||||
LogPrintf("CMasternodePing::CheckAndUpdate -- Signature rejected, too far into the past: masternode=%s sigTime=%d GetAdjustedTime()=%d\n", vin.prevout.ToStringShort(), sigTime, GetAdjustedTime());
|
||||
nDos = 1;
|
||||
return false;
|
||||
}
|
||||
|
||||
{
|
||||
LOCK(cs_main);
|
||||
BlockMap::iterator mi = mapBlockIndex.find(blockHash);
|
||||
@ -811,8 +805,6 @@ bool CMasternodePing::CheckAndUpdate(int& nDos, bool fRequireEnabled, bool fSimp
|
||||
return false;
|
||||
}
|
||||
|
||||
if (fRequireEnabled && !pmn->IsEnabled() && !pmn->IsPreEnabled() && !pmn->IsWatchdogExpired()) return false;
|
||||
|
||||
// LogPrintf("mnping - Found corresponding mn for vin: %s\n", vin.prevout.ToStringShort());
|
||||
// update only if there is no known ping for this masternode or
|
||||
// last ping was more then MASTERNODE_MIN_MNP_SECONDS-60 ago comparing to this one
|
||||
|
@ -78,7 +78,7 @@ public:
|
||||
|
||||
bool Sign(CKey& keyMasternode, CPubKey& pubKeyMasternode);
|
||||
bool CheckSignature(CPubKey& pubKeyMasternode, int &nDos);
|
||||
bool CheckAndUpdate(int& nDos, bool fRequireEnabled = true, bool fSimpleCheck = false);
|
||||
bool CheckAndUpdate(int& nDos, bool fSimpleCheck = false);
|
||||
void Relay();
|
||||
|
||||
CMasternodePing& operator=(CMasternodePing from)
|
||||
|
@ -123,9 +123,6 @@ bool CMasternodeMan::Add(CMasternode &mn)
|
||||
{
|
||||
LOCK(cs);
|
||||
|
||||
if (!mn.IsEnabled() && !mn.IsPreEnabled())
|
||||
return false;
|
||||
|
||||
CMasternode *pmn = Find(mn.vin);
|
||||
if (pmn == NULL) {
|
||||
LogPrint("masternode", "CMasternodeMan::Add -- Adding new Masternode: addr=%s, %i now\n", mn.addr.ToString(), size() + 1);
|
||||
@ -733,7 +730,7 @@ void CMasternodeMan::ProcessMessage(CNode* pfrom, std::string& strCommand, CData
|
||||
LogPrint("masternode", "MNPING -- Masternode ping, masternode=%s new\n", mnp.vin.prevout.ToStringShort());
|
||||
|
||||
int nDos = 0;
|
||||
if(mnp.CheckAndUpdate(nDos, false)) return;
|
||||
if(mnp.CheckAndUpdate(nDos)) return;
|
||||
|
||||
if(nDos > 0) {
|
||||
// if anything significant failed, mark that node
|
||||
|
Loading…
Reference in New Issue
Block a user