Skip to content

Commit 4f9f573

Browse files
authored
ReplayFromSnapshot tracer: remove redundant RealPoint argument (#1236)
2 parents 0cae17c + ae668fd commit 4f9f573

File tree

2 files changed

+11
-10
lines changed

2 files changed

+11
-10
lines changed
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
### Breaking
2+
3+
- Removed `RealPoint` argument from `ReplayFromSnapshot`. Use the `ReplayStart`
4+
field instead.

ouroboros-consensus/src/ouroboros-consensus/Ouroboros/Consensus/Storage/LedgerDB/Init.hs

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,6 @@ import Data.Word
2626
import GHC.Generics (Generic)
2727
import GHC.Stack
2828
import Ouroboros.Consensus.Block
29-
import Ouroboros.Consensus.HeaderValidation
30-
(HeaderState (headerStateTip), annTipPoint)
3129
import Ouroboros.Consensus.Ledger.Abstract
3230
import Ouroboros.Consensus.Ledger.Extended
3331
import Ouroboros.Consensus.Ledger.Inspect
@@ -176,19 +174,19 @@ initFromSnapshot ::
176174
initFromSnapshot 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
194192
initStartingWith ::
@@ -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

Comments
 (0)