diff --git a/src/ripple/app/ledger/impl/LedgerMaster.cpp b/src/ripple/app/ledger/impl/LedgerMaster.cpp index f2911465f4..db1b571213 100644 --- a/src/ripple/app/ledger/impl/LedgerMaster.cpp +++ b/src/ripple/app/ledger/impl/LedgerMaster.cpp @@ -1560,9 +1560,12 @@ LedgerMaster::shouldAcquire ( std::uint32_t const ledgerHistoryIndex, std::uint32_t const candidateLedger) const { - bool ret (candidateLedger >= currentLedger || - candidateLedger > ledgerHistoryIndex || - (currentLedger - candidateLedger) <= ledgerHistory); + // If the ledger could be the current ledger acquire it. + // Otherwise, acquire it only if it's within our range of + // desired history and we wouldn't delete it if we had it. + bool ret = (candidateLedger >= currentLedger) || + ((candidateLedger >= ledgerHistoryIndex) && + ((currentLedger - candidateLedger) <= ledgerHistory)); JLOG (m_journal.trace()) << "Missing ledger "