From 7e8436cb502f5021a977877046b59d7987f661f1 Mon Sep 17 00:00:00 2001 From: Richard Holland Date: Tue, 1 Apr 2025 13:04:45 +1100 Subject: [PATCH] return rpc error instead of continuing when ledger header isn't read --- src/ripple/rpc/handlers/Catalogue.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/ripple/rpc/handlers/Catalogue.cpp b/src/ripple/rpc/handlers/Catalogue.cpp index 40a0f93b5..28768d50d 100644 --- a/src/ripple/rpc/handlers/Catalogue.cpp +++ b/src/ripple/rpc/handlers/Catalogue.cpp @@ -987,9 +987,11 @@ doCatalogueLoad(RPC::JsonContext& context) reinterpret_cast(&parentCloseTime), sizeof(parentCloseTime))) { - JLOG(context.j.warn()) << "Catalogue load expected but could not " - "read the next ledger header."; - break; + JLOG(context.j.warn()) + << "Catalogue load expected but could not " + << "read the next ledger header at seq=" << expected_seq << ". " + << "Ledgers prior to this in the file (if any) were loaded."; + return rpcError(rpcINTERNAL, "Unexpected end of catalogue file."); } info.closeTime = time_point{duration{closeTime}};