diff --git a/src/catchup/VerifyLedgerChainWork.cpp b/src/catchup/VerifyLedgerChainWork.cpp index 327df362c0..a5603fd1e0 100644 --- a/src/catchup/VerifyLedgerChainWork.cpp +++ b/src/catchup/VerifyLedgerChainWork.cpp @@ -185,6 +185,8 @@ VerifyLedgerChainWork::verifyHistoryOfSingleCheckpoint() CLOG_DEBUG(History, "Verifying ledger headers from {} for checkpoint {}", ft.localPath_nogz(), mCurrCheckpoint); + auto const& hm = mApp.getHistoryManager(); + while (hdrIn) { try @@ -243,6 +245,15 @@ VerifyLedgerChainWork::verifyHistoryOfSingleCheckpoint() if (beginCheckpoint) { + if (!hm.isFirstLedgerInCheckpoint(curr.header.ledgerSeq)) + { + CLOG_ERROR( + History, "Checkpoint did not start with {} - got {}", + hm.firstLedgerInCheckpointContaining(curr.header.ledgerSeq), + curr.header.ledgerSeq); + return HistoryManager::VERIFY_STATUS_ERR_MISSING_ENTRIES; + } + // At the beginning of checkpoint, we can't verify the link with // previous ledger, so at least verify that header content hashes to // correct value diff --git a/src/history/HistoryManagerImpl.cpp b/src/history/HistoryManagerImpl.cpp index 41e3f3a6f7..cb24896ce0 100644 --- a/src/history/HistoryManagerImpl.cpp +++ b/src/history/HistoryManagerImpl.cpp @@ -159,6 +159,9 @@ HistoryManagerImpl::dropSQLBasedPublish() populateCheckpointFilesFromDB(mApp, mApp.getDatabase().getSession(), firstLedgerInCheckpointContaining(lcl), freq, *mCheckpoint); + LedgerHeaderUtils::copyToStream( + mApp.getDatabase(), mApp.getDatabase().getSession(), + firstLedgerInCheckpointContaining(lcl), freq, *mCheckpoint); } mApp.getDatabase().clearPreparedStatementCache();