Skip to content

Commit

Permalink
stability fix for masternodes syncing
Browse files Browse the repository at this point in the history
  • Loading branch information
Evan Duffield committed Oct 22, 2014
1 parent 14071c5 commit 84d2226
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4321,6 +4321,13 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv)
if(!mn.UpdatedWithin(MASTERNODE_MIN_SECONDS)){
mn.UpdateLastSeen();

if(mn.vin.now < sigTime){
printf("dsee - Got updated entry for %s\n", addr.ToString().c_str());
mn.pubkey2 = pubkey2;
mn.now = sigTime
mn.sig = vchSig;
}

if(pubkey2 == darkSendPool.pubkeyMasterNode2){
darkSendPool.EnableHotColdMasterNode(vin, sigTime, addr);
}
Expand Down Expand Up @@ -4395,15 +4402,15 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv)
bool stop;
vRecv >> vin >> vchSig >> sigTime >> stop;

if (sigTime > GetAdjustedTime() + 15 * 60) {
if (sigTime > GetAdjustedTime() + 60 * 60) {
LogPrintf("dseep: Signature rejected, too far into the future %s\n", vin.ToString().c_str());
pfrom->Misbehaving(20);
return false;
}

if (sigTime <= GetAdjustedTime() - 15 * 60) {
if (sigTime <= GetAdjustedTime() - 60 * 60) {
LogPrintf("dseep: Signature rejected, too far into the past %s\n", vin.ToString().c_str());
pfrom->Misbehaving(20);
//pfrom->Misbehaving(20);
return false;
}

Expand All @@ -4417,7 +4424,7 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv)
std::string errorMessage = "";
if(!darkSendSigner.VerifyMessage(mn.pubkey2, vchSig, strMessage, errorMessage)){
LogPrintf("dseep: Got bad masternode address signature %s \n", vin.ToString().c_str());
pfrom->Misbehaving(20);
//pfrom->Misbehaving(20);
return false;
}

Expand Down

0 comments on commit 84d2226

Please sign in to comment.