mirror of
https://github.com/XRPLF/rippled.git
synced 2025-11-25 05:25:55 +00:00
Be paranoid about ledger compatibility:
* Consider ledgers incompatible based on last valid ledger * Test against even ledgers not acquired yet * Don't validate an incompatible ledger * Don't switch to an incompatible ledger * Protect against an unreasonably small quorum
This commit is contained in:
@@ -1262,6 +1262,21 @@ bool NetworkOPsImp::checkLastClosedLedger (
|
||||
if (!switchLedgers)
|
||||
return false;
|
||||
|
||||
Ledger::pointer consensus = m_ledgerMaster.getLedgerByHash (closedLedger);
|
||||
|
||||
if (!consensus)
|
||||
consensus = getApp().getInboundLedgers().acquire (
|
||||
closedLedger, 0, InboundLedger::fcCONSENSUS);
|
||||
|
||||
if (consensus &&
|
||||
! m_ledgerMaster.isCompatible (consensus, m_journal.debug,
|
||||
"Not switching"))
|
||||
{
|
||||
// Don't switch to a ledger not on the validated chain
|
||||
networkClosed = ourClosed->getHash ();
|
||||
return false;
|
||||
}
|
||||
|
||||
m_journal.warning << "We are not running on the consensus ledger";
|
||||
m_journal.info << "Our LCL: " << getJson (*ourClosed);
|
||||
m_journal.info << "Net LCL " << closedLedger;
|
||||
@@ -1269,12 +1284,6 @@ bool NetworkOPsImp::checkLastClosedLedger (
|
||||
if ((mMode == omTRACKING) || (mMode == omFULL))
|
||||
setMode (omCONNECTED);
|
||||
|
||||
Ledger::pointer consensus = m_ledgerMaster.getLedgerByHash (closedLedger);
|
||||
|
||||
if (!consensus)
|
||||
consensus = getApp().getInboundLedgers().acquire (
|
||||
closedLedger, 0, InboundLedger::fcCONSENSUS);
|
||||
|
||||
if (consensus)
|
||||
{
|
||||
clearNeedNetworkLedger ();
|
||||
|
||||
Reference in New Issue
Block a user