@@ -47,7 +47,6 @@ import Cardano.Prelude hiding (Nat, (%))
47
47
import Cardano.Slotting.Slot (EpochNo (.. ))
48
48
import Control.Concurrent.Async
49
49
import Control.Monad.Extra (whenJust )
50
- import qualified Data.Strict.Maybe as Strict
51
50
import qualified Data.Text as Text
52
51
import Data.Version (showVersion )
53
52
import Database.Persist.Postgresql (ConnectionString , withPostgresqlConn )
@@ -160,8 +159,7 @@ runSyncNode ::
160
159
IO ()
161
160
runSyncNode metricsSetters trce iomgr dbConnString ranMigrations runMigrationFnc syncNodeConfigFromFile syncNodeParams syncOptions = do
162
161
whenJust maybeLedgerDir $
163
- \ enpLedgerStateDir -> do
164
- createDirectoryIfMissing True (unLedgerStateDir enpLedgerStateDir)
162
+ \ enpLedgerStateDir -> createDirectoryIfMissing True (unLedgerStateDir enpLedgerStateDir)
165
163
logInfo trce $ " Using byron genesis file from: " <> (show . unGenesisFile $ dncByronGenesisFile syncNodeConfigFromFile)
166
164
logInfo trce $ " Using shelley genesis file from: " <> (show . unGenesisFile $ dncShelleyGenesisFile syncNodeConfigFromFile)
167
165
logInfo trce $ " Using alonzo genesis file from: " <> (show . unGenesisFile $ dncAlonzoGenesisFile syncNodeConfigFromFile)
@@ -170,39 +168,38 @@ runSyncNode metricsSetters trce iomgr dbConnString ranMigrations runMigrationFnc
170
168
171
169
Db. runIohkLogging trce $
172
170
withPostgresqlConn dbConnString $
173
- \ backend -> liftIO $ do
174
- runOrThrowIO $ runExceptT $ do
175
- genCfg <- readCardanoGenesisConfig syncNodeConfigFromFile
176
- logProtocolMagicId trce $ genesisProtocolMagicId genCfg
177
- syncEnv <-
178
- ExceptT $
179
- mkSyncEnvFromConfig
180
- trce
181
- backend
182
- dbConnString
183
- syncOptions
184
- genCfg
185
- syncNodeConfigFromFile
186
- syncNodeParams
187
- ranMigrations
188
- runMigrationFnc
189
- liftIO $ runExtraMigrationsMaybe syncEnv
190
- unless useLedger $ liftIO $ do
191
- logInfo trce " Migrating to a no ledger schema"
192
- Db. noLedgerMigrations backend trce
193
- insertValidateGenesisDist syncEnv (dncNetworkName syncNodeConfigFromFile) genCfg (useShelleyInit syncNodeConfigFromFile)
171
+ \ backend -> liftIO $ runOrThrowIO $ runExceptT $ do
172
+ genCfg <- readCardanoGenesisConfig syncNodeConfigFromFile
173
+ logProtocolMagicId trce $ genesisProtocolMagicId genCfg
174
+ syncEnv <-
175
+ ExceptT $
176
+ mkSyncEnvFromConfig
177
+ trce
178
+ backend
179
+ dbConnString
180
+ syncOptions
181
+ genCfg
182
+ syncNodeConfigFromFile
183
+ syncNodeParams
184
+ ranMigrations
185
+ runMigrationFnc
186
+ liftIO $ runExtraMigrationsMaybe syncEnv
187
+ unless useLedger $ liftIO $ do
188
+ logInfo trce " Migrating to a no ledger schema"
189
+ Db. noLedgerMigrations backend trce
190
+ insertValidateGenesisDist syncEnv (dncNetworkName syncNodeConfigFromFile) genCfg (useShelleyInit syncNodeConfigFromFile)
194
191
195
- -- communication channel between datalayer thread and chainsync-client thread
196
- threadChannels <- liftIO newThreadChannels
197
- liftIO $
198
- mapConcurrently_
199
- id
200
- [ runDbThread syncEnv metricsSetters threadChannels
201
- , runSyncNodeClient metricsSetters syncEnv iomgr trce threadChannels (enpSocketPath syncNodeParams)
202
- , runFetchOffChainPoolThread syncEnv
203
- , runFetchOffChainVoteThread syncEnv
204
- , runLedgerStateWriteThread (getTrace syncEnv) (envLedgerEnv syncEnv)
205
- ]
192
+ -- communication channel between datalayer thread and chainsync-client thread
193
+ threadChannels <- liftIO newThreadChannels
194
+ liftIO $
195
+ mapConcurrently_
196
+ id
197
+ [ runDbThread syncEnv metricsSetters threadChannels
198
+ , runSyncNodeClient metricsSetters syncEnv iomgr trce threadChannels (enpSocketPath syncNodeParams)
199
+ , runFetchOffChainPoolThread syncEnv
200
+ , runFetchOffChainVoteThread syncEnv
201
+ , runLedgerStateWriteThread (getTrace syncEnv) (envLedgerEnv syncEnv)
202
+ ]
206
203
where
207
204
useShelleyInit :: SyncNodeConfig -> Bool
208
205
useShelleyInit cfg =
@@ -245,23 +242,16 @@ extractSyncOptions snp aop snc =
245
242
, snapshotEveryLagging = enpSnEveryLagging snp
246
243
}
247
244
where
248
- maybeKeepMNames =
249
- case sioMetadata (dncInsertOptions snc) of
250
- MetadataKeys ks -> Strict. Just (map fromIntegral $ toList ks)
251
- MetadataEnable -> Strict. Nothing
252
- MetadataDisable -> Strict. Nothing
253
-
254
245
iopts =
255
246
InsertOptions
256
247
{ ioInOut = isTxOutEnabled'
257
248
, ioUseLedger = useLedger
258
249
, ioShelley = isShelleyEnabled (sioShelley (dncInsertOptions snc))
259
250
, -- Rewards are only disabled on "disable_all" and "only_gov" presets
260
251
ioRewards = True
261
- , ioMultiAssets = isMultiAssetEnabled (sioMultiAsset (dncInsertOptions snc))
262
- , ioMetadata = isMetadataEnabled (sioMetadata (dncInsertOptions snc))
263
- , ioKeepMetadataNames = maybeKeepMNames
264
- , ioPlutusExtra = isPlutusEnabled (sioPlutus (dncInsertOptions snc))
252
+ , ioMultiAssets = sioMultiAsset (dncInsertOptions snc)
253
+ , ioMetadata = sioMetadata (dncInsertOptions snc)
254
+ , ioPlutus = sioPlutus (dncInsertOptions snc)
265
255
, ioOffChainPoolData = useOffchainPoolData
266
256
, ioGov = useGovernance
267
257
}
0 commit comments