Replace Ledger with ReadView in most RPC handlers.

This commit is contained in:
Tom Ritchford
2015-07-08 12:12:47 -04:00
committed by Vinnie Falco
parent c7ebe7205c
commit 1d09c54fdc
33 changed files with 166 additions and 127 deletions

View File

@@ -1264,6 +1264,36 @@ public:
return mPubLedger;
}
bool isValidLedger(LedgerInfo const& info) override
{
if (info.validated)
return true;
if (info.open)
return false;
auto seq = info.seq;
try
{
// Use the skip list in the last validated ledger to see if ledger
// comes before the last validated ledger (and thus has been
// validated).
auto hash = walkHashBySeq (seq);
if (info.hash != hash)
return false;
}
catch (SHAMapMissingNode const&)
{
WriteLog (lsWARNING, RPCHandler)
<< "Missing SHANode " << std::to_string (seq);
return false;
}
// Mark ledger as validated to save time if we see it again.
info.validated = true;
return true;
}
int getMinValidations ()
{
return mMinValidations;