@@ -26,8 +26,6 @@ import Data.Word
2626import GHC.Generics (Generic )
2727import GHC.Stack
2828import Ouroboros.Consensus.Block
29- import Ouroboros.Consensus.HeaderValidation
30- (HeaderState (headerStateTip ), annTipPoint )
3129import Ouroboros.Consensus.Ledger.Abstract
3230import Ouroboros.Consensus.Ledger.Extended
3331import Ouroboros.Consensus.Ledger.Inspect
@@ -176,19 +174,19 @@ initFromSnapshot ::
176174initFromSnapshot tracer hasFS decLedger decHash cfg stream ss = do
177175 initSS <- withExceptT InitFailureRead $
178176 readSnapshot hasFS decLedger decHash ss
179- let initialPoint = withOrigin ( Point Origin ) annTipPoint $ headerStateTip $ headerState $ initSS
180- case pointToWithOriginRealPoint (castPoint (getTip initSS)) of
181- Origin -> throwError InitFailureGenesis
182- NotOrigin tip -> do
183- lift $ traceWith tracer $ ReplayFromSnapshot ss tip ( ReplayStart initialPoint)
184- let tracer' = decorateReplayTracerWithStart initialPoint tracer
177+ let replayStart = castPoint $ getTip initSS
178+ case pointToWithOriginRealPoint replayStart of
179+ Origin -> throwError InitFailureGenesis
180+ NotOrigin realReplayStart -> do
181+ let tracer' = decorateReplayTracerWithStart replayStart tracer
182+ lift $ traceWith tracer' $ ReplayFromSnapshot ss
185183 (initDB, replayed) <-
186184 initStartingWith
187185 tracer'
188186 cfg
189187 stream
190188 (ledgerDbWithAnchor initSS)
191- return (tip , initDB, replayed)
189+ return (realReplayStart , initDB, replayed)
192190
193191-- | Attempt to initialize the ledger DB starting from the given ledger DB
194192initStartingWith ::
@@ -267,7 +265,6 @@ data TraceReplayEvent blk
267265 -- We're replaying more recent blocks against it.
268266 | ReplayFromSnapshot
269267 DiskSnapshot
270- (RealPoint blk )
271268 (ReplayStart blk ) -- ^ the block at which this replay started
272269 (ReplayGoal blk ) -- ^ the block at the tip of the ImmutableDB
273270 -- | We replayed the given block (reference) on the genesis snapshot during
0 commit comments