From b07da94c31bba3965597aae94f7ea916cc5d1492 Mon Sep 17 00:00:00 2001 From: Scott Schurr Date: Fri, 2 Feb 2018 13:47:26 -0800 Subject: [PATCH] Remove two inaccurate asserts: The assert in LedgerHistory.cpp was incorrect since getLedgerByHash() can return a null object. The assert has been seen to fire inappropriately during online_delete. The assert in LedgerMaster.cpp was simply misguided. If a null hash were returned by getLedgerHashForHistory(), then we should not forward that hash to peers. The assert only fires in a debug build, so a release build would forward the request for a null hash to peers. --- src/ripple/app/ledger/LedgerHistory.cpp | 1 - src/ripple/app/ledger/impl/LedgerMaster.cpp | 3 +-- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/src/ripple/app/ledger/LedgerHistory.cpp b/src/ripple/app/ledger/LedgerHistory.cpp index 635308eb5..9a7da8fcd 100644 --- a/src/ripple/app/ledger/LedgerHistory.cpp +++ b/src/ripple/app/ledger/LedgerHistory.cpp @@ -500,7 +500,6 @@ void LedgerHistory::clearLedgerCachePrior (LedgerIndex seq) for (LedgerHash it: m_ledgers_by_hash.getKeys()) { auto const ledger = getLedgerByHash (it); - assert(ledger); if (!ledger || ledger->info().seq < seq) m_ledgers_by_hash.del (it, false); } diff --git a/src/ripple/app/ledger/impl/LedgerMaster.cpp b/src/ripple/app/ledger/impl/LedgerMaster.cpp index 6ed8a8b6c..2276edf6c 100644 --- a/src/ripple/app/ledger/impl/LedgerMaster.cpp +++ b/src/ripple/app/ledger/impl/LedgerMaster.cpp @@ -504,14 +504,13 @@ LedgerMaster::getFetchPack (LedgerIndex missingIndex, { auto haveHash = getLedgerHashForHistory( missingIndex + 1, reason); - if (!haveHash) + if (!haveHash || haveHash->isZero()) { JLOG (m_journal.error()) << "No hash for fetch pack. Missing Index " << std::to_string(missingIndex); return; } - assert(haveHash->isNonZero()); // Select target Peer based on highest score. The score is randomized // but biased in favor of Peers with low latency.