From dcfb650d9f97685eb1a2e84830f1002e22320254 Mon Sep 17 00:00:00 2001 From: Sami Ahmed Date: Fri, 19 Jun 2026 02:54:58 -0700 Subject: [PATCH] init: don't fail on ResetSyncCheckpoint for snapshot-sourced chains MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When LoadBlockIndex tries to reset the sync-checkpoint, it looks for one of the known checkpoint blocks in mapBlockIndex and writes it to the DB. For a freshly snapshot-loaded chain, mapBlockIndex only has ~1166 headers near the tip — none of the known sync checkpoints (2205000, 2206004) are in that subset. The reset returns false (no checkpoint found in main chain), and the caller currently treats this as fatal: 'failed to reset sync-checkpoint'. But for snapshot-sourced chains this is expected — the sync checkpoint will be set when the node syncs past the next known checkpoint height. Soften the failure: if fLoadedFromSnapshot is true, log a warning and continue instead of erroring out. --- src/main.cpp | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/src/main.cpp b/src/main.cpp index 1cbe232..69318cb 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -3463,7 +3463,17 @@ bool LoadBlockIndex(bool fAllowNew) if (!txdb.TxnCommit()) return error("LoadBlockIndex() : failed to commit new checkpoint master key to db"); if ((!fTestNet) && !Checkpoints::ResetSyncCheckpoint()) - return error("LoadBlockIndex() : failed to reset sync-checkpoint"); + { + // For snapshot-sourced chains, the small initial block index may + // not include any of the known sync checkpoints yet (snapshot only + // includes ~1166 headers near tip). The sync checkpoint will be + // set when the node syncs past a known checkpoint height. + if (fLoadedFromSnapshot) { + printf("LoadBlockIndex(): sync-checkpoint reset deferred (snapshot-sourced, no checkpoints in small index yet)\n"); + } else { + return error("LoadBlockIndex() : failed to reset sync-checkpoint"); + } + } } return true;