mirror of
https://github.com/Xahau/xahaud.git
synced 2025-12-06 17:27:52 +00:00
Fix a case where a node that closed slightly ahead of other ledgers can
think it's out of sync with the network and cause it to jump backwards one ledger, causing it to be out of sync because the network was about to catch up to it.
This commit is contained in:
@@ -228,10 +228,11 @@ std::list<SerializedValidation::pointer> ValidationCollection::getCurrentTrusted
|
||||
}
|
||||
|
||||
boost::unordered_map<uint256, currentValidationCount>
|
||||
ValidationCollection::getCurrentValidations(uint256 currentLedger)
|
||||
ValidationCollection::getCurrentValidations(uint256 currentLedger, uint256 priorLedger)
|
||||
{
|
||||
uint32 cutoff = theApp->getOPs().getNetworkTimeNC() - LEDGER_VAL_INTERVAL;
|
||||
bool valCurrentLedger = currentLedger.isNonZero();
|
||||
bool valPriorLedger = priorLedger.isNonZero();
|
||||
|
||||
boost::unordered_map<uint256, currentValidationCount> ret;
|
||||
|
||||
@@ -250,7 +251,8 @@ ValidationCollection::getCurrentValidations(uint256 currentLedger)
|
||||
}
|
||||
else
|
||||
{ // contains a live record
|
||||
bool countPreferred = valCurrentLedger && it->second->isPreviousHash(currentLedger);
|
||||
bool countPreferred = (valCurrentLedger && it->second->isPreviousHash(currentLedger)) ||
|
||||
(valPriorLedger && (it->second->getLedgerHash() == priorLedger));
|
||||
tLog(countPreferred, lsDEBUG) << "Counting for " << currentLedger << " not " << it->second->getLedgerHash();
|
||||
currentValidationCount& p = countPreferred ? ret[currentLedger] : ret[it->second->getLedgerHash()];
|
||||
|
||||
|
||||
Reference in New Issue
Block a user