mirror of
https://github.com/Xahau/xahaud.git
synced 2025-12-06 17:27:52 +00:00
Remove a ledger from the set of present ledgers where needed
* If we encounter it in RPC * If we fully-validate a ledger that doesn't have it in its history
This commit is contained in:
@@ -152,8 +152,21 @@ bool isValidated (LedgerMaster& ledgerMaster, ReadView const& ledger)
|
||||
// comes before the last validated ledger (and thus has been
|
||||
// validated).
|
||||
auto hash = ledgerMaster.walkHashBySeq (seq);
|
||||
|
||||
if (ledger.info().hash != hash)
|
||||
{
|
||||
// This ledger's hash is not the hash of the validated ledger
|
||||
if (hash.isNonZero ())
|
||||
{
|
||||
uint256 valHash = Ledger::getHashByIndex (seq);
|
||||
if (valHash == ledger.info().hash)
|
||||
{
|
||||
// SQL database doesn't match ledger chain
|
||||
ledgerMaster.clearLedger (seq);
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
catch (SHAMapMissingNode const&)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user