From 904d788afcb6d922a1a2c90e0060db24e40aa6ff Mon Sep 17 00:00:00 2001 From: TheLazieR Yip Date: Mon, 7 Mar 2016 15:42:37 +0700 Subject: [PATCH] Check New MasterNodeBroadcast Time backport of #722 --- src/masternode.cpp | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/src/masternode.cpp b/src/masternode.cpp index f65f052c1d26e..c77c7635e13f2 100644 --- a/src/masternode.cpp +++ b/src/masternode.cpp @@ -398,8 +398,18 @@ bool CMasternodeBroadcast::CheckAndUpdate(int& nDos) //search existing Masternode list, this is where we update existing Masternodes with new mnb broadcasts CMasternode* pmn = mnodeman.Find(vin); - // no such masternode or it's not enabled already, nothing to update - if(pmn == NULL || (pmn != NULL && !pmn->IsEnabled())) return true; + // no such masternode, nothing to update + if(pmn == NULL) return true ; + else { + // this broadcast older than we have, it's bad. + if(pmn->sigTime > sigTime) { + LogPrintf("mnb - Bad sigTime %d for Masternode %20s %105s (existing broadcast is at %d)\n", + sigTime, addr.ToString(), vin.ToString(), pmn->sigTime); + return false; + } + // masternode is not enabled yet/already, nothing to update + if(!pmn->IsEnabled()) return true; + } // mn.pubkey = pubkey, IsVinAssociatedWithPubkey is validated once below, // after that they just need to match