mirror of
https://github.com/XRPLF/rippled.git
synced 2025-11-19 18:45:52 +00:00
Fix check for current ledger ID in RPC
This commit is contained in:
committed by
Vinnie Falco
parent
29d644e9d3
commit
568e4cebda
@@ -146,14 +146,24 @@ error_code_i fillHandler (Context& context,
|
||||
return rpcNO_NETWORK;
|
||||
}
|
||||
|
||||
if (!getConfig ().RUN_STANDALONE
|
||||
&& (handler->condition_ & NEEDS_CURRENT_LEDGER)
|
||||
&& (getApp().getLedgerMaster().getValidatedLedgerAge() >
|
||||
Tuning::maxValidatedLedgerAge
|
||||
|| context.netOps.getCurrentLedgerID() <=
|
||||
context.netOps.getValidatedLedger ()->getLedgerSeq ()))
|
||||
if (! getConfig ().RUN_STANDALONE &&
|
||||
handler->condition_ & NEEDS_CURRENT_LEDGER)
|
||||
{
|
||||
return rpcNO_CURRENT;
|
||||
if (getApp ().getLedgerMaster ().getValidatedLedgerAge () >
|
||||
Tuning::maxValidatedLedgerAge)
|
||||
{
|
||||
return rpcNO_CURRENT;
|
||||
}
|
||||
|
||||
auto const cID = context.netOps.getCurrentLedgerID ();
|
||||
auto const vID = context.netOps.getValidatedSeq ();
|
||||
|
||||
if (cID + 10 < vID)
|
||||
{
|
||||
WriteLog (lsDEBUG, RPCHandler) << "Current ledger ID(" << cID <<
|
||||
") is less than validated ledger ID(" << vID << ")";
|
||||
return rpcNO_CURRENT;
|
||||
}
|
||||
}
|
||||
|
||||
if ((handler->condition_ & NEEDS_CLOSED_LEDGER) &&
|
||||
|
||||
Reference in New Issue
Block a user