@@ -85,14 +85,14 @@ import Cardano.DbSync.Error
8585import Cardano.DbSync.Ledger.Event (LedgerEvent (.. ))
8686import Cardano.DbSync.Ledger.State (
8787 getHeaderHash ,
88- hashToAnnotation ,
8988 listKnownSnapshots ,
9089 mkHasLedgerEnv ,
9190 )
92- import Cardano.DbSync.Ledger.Types (HasLedgerEnv (.. ), LedgerStateFile ( .. ), SnapshotPoint (.. ))
91+ import Cardano.DbSync.Ledger.Types (HasLedgerEnv (.. ), SnapshotPoint (.. ))
9392import Cardano.DbSync.LocalStateQuery
9493import Cardano.DbSync.Types
9594import Cardano.DbSync.Util
95+ import Ouroboros.Consensus.Storage.LedgerDB.Snapshots (DiskSnapshot (.. ))
9696
9797setConsistentLevel :: SyncEnv -> ConsistentLevel -> IO ()
9898setConsistentLevel env cst = do
@@ -341,7 +341,15 @@ mkSyncEnv metricSetters trce dbEnv syncOptions protoInfo nw maxLovelaceSupply nw
341341 else pure useNoCache
342342 consistentLevelVar <- newTVarIO Unchecked
343343 indexesVar <- newTVarIO $ enpForceIndexes syncNP
344- bts <- getBootstrapInProgress trce (isTxOutConsumedBootstrap' syncNodeConfigFromFile) dbEnv
344+ let bootstrapFlag = isTxOutConsumedBootstrap' syncNodeConfigFromFile
345+ case (bootstrapFlag, dncLedgerBackend syncNodeConfigFromFile) of
346+ (True , LedgerBackendLSM _) ->
347+ DB. logAndThrowIO trce $
348+ " bootstrap-tx-out is not supported with ledger_backend=lsm. "
349+ <> " The bootstrap path reads the full UTxO from the in-memory ledger state, "
350+ <> " which is empty under LSM. Use ledger_backend=inmemory or disable bootstrap."
351+ _ -> pure ()
352+ bts <- getBootstrapInProgress trce bootstrapFlag dbEnv
345353 bootstrapVar <- newTVarIO bts
346354 -- Offline Pool + Anchor queues
347355 opwq <- newTBQueueIO 1000
@@ -363,6 +371,7 @@ mkSyncEnv metricSetters trce dbEnv syncOptions protoInfo nw maxLovelaceSupply nw
363371 maxLovelaceSupply
364372 systemStart
365373 syncOptions
374+ (dncLedgerBackend syncNodeConfigFromFile)
366375 (Nothing , False ) -> NoLedger <$> mkNoLedgerEnv trce protoInfo nw systemStart
367376 (Just _, False ) -> do
368377 logWarning trce $
@@ -472,11 +481,11 @@ verifySnapshotPoint env snapPoints =
472481 catMaybes <$> mapM validLedgerFileToPoint snapPoints
473482 where
474483 validLedgerFileToPoint :: SnapshotPoint -> IO (Maybe (CardanoPoint , Bool ))
475- validLedgerFileToPoint (OnDisk lsf ) = do
476- hashes <- getSlotHash (envDbEnv env) (lsfSlotNo lsf )
477- let valid = find ( \ (_, h) -> lsfHash lsf == hashToAnnotation h) hashes
478- case valid of
479- Just (slot, hash) | slot == lsfSlotNo lsf -> pure $ convertToDiskPoint slot hash
484+ validLedgerFileToPoint (OnDisk ds ) = do
485+ let slot = SlotNo (dsNumber ds )
486+ hashes <- getSlotHash (envDbEnv env) slot
487+ case hashes of
488+ [(s, _h)] | s == slot -> pure $ convertToDiskPoint slot _h
480489 _ -> pure Nothing
481490 validLedgerFileToPoint (InMemory pnt) = do
482491 case pnt of
0 commit comments