Restore relaying and fix rate threshold (#1206)

* Restore object relaying during orphan processing

* Relay votes during orphan processing

* Allow relaying of objects and votes during syncing

* Double rate check threshold
This commit is contained in:
Tim Flynn 2016-12-15 11:27:09 -05:00 committed by UdjinM6
parent 8fc8e6c8c2
commit 84c242fc8c
3 changed files with 5 additions and 4 deletions

View File

@ -644,7 +644,6 @@ bool CGovernanceObject::GetCurrentMNVotes(const CTxIn& mnCollateralOutpoint, vot
void CGovernanceObject::Relay()
{
if(!masternodeSync.IsSynced()) return;
CInv inv(MSG_GOVERNANCE_OBJECT, GetHash());
RelayInv(inv, PROTOCOL_VERSION);
}
@ -732,6 +731,7 @@ void CGovernanceObject::CheckOrphanVotes()
LogPrintf("CGovernanceObject::CheckOrphanVotes -- Failed to add orphan vote: %s\n", exception.what());
}
else {
vote.Relay();
fRemove = true;
}
++it;

View File

@ -235,7 +235,6 @@ CGovernanceVote::CGovernanceVote(CTxIn vinMasternodeIn, uint256 nParentHashIn, v
void CGovernanceVote::Relay() const
{
if(!masternodeSync.IsSynced()) return;
CInv inv(MSG_GOVERNANCE_OBJECT_VOTE, GetHash());
RelayInv(inv, PROTOCOL_VERSION);
}

View File

@ -280,6 +280,7 @@ void CGovernanceManager::CheckOrphanVotes(CGovernanceObject& govobj, CGovernance
fRemove = true;
}
else if(govobj.ProcessVote(NULL, vote, exception)) {
vote.Relay();
fRemove = true;
}
if(fRemove) {
@ -785,7 +786,7 @@ bool CGovernanceManager::MasternodeRateCheck(const CGovernanceObject& govobj, bo
switch(nObjectType) {
case GOVERNANCE_OBJECT_TRIGGER:
// Allow 1 trigger per mn per cycle, with a small fudge factor
dMaxRate = 1.1 / nSuperblockCycleSeconds;
dMaxRate = 2 * 1.1 / double(nSuperblockCycleSeconds);
buffer = it->second.triggerBuffer;
buffer.AddTimestamp(nTimestamp);
dRate = buffer.GetRate();
@ -794,7 +795,7 @@ bool CGovernanceManager::MasternodeRateCheck(const CGovernanceObject& govobj, bo
}
break;
case GOVERNANCE_OBJECT_WATCHDOG:
dMaxRate = 1.1 / 3600.;
dMaxRate = 2 * 1.1 / 3600.;
buffer = it->second.watchdogBuffer;
buffer.AddTimestamp(nTimestamp);
dRate = buffer.GetRate();
@ -907,6 +908,7 @@ void CGovernanceManager::CheckMasternodeOrphanObjects()
if(AddGovernanceObject(govobj)) {
LogPrintf("CGovernanceManager::CheckMasternodeOrphanObjects -- %s new\n", govobj.GetHash().ToString());
govobj.Relay();
mapMasternodeOrphanObjects.erase(it++);
}
else {