@@ -206,8 +206,8 @@ dbSyncProtocols syncEnv metricsSetters tc codecConfig version bversion =
206
206
tracer :: Trace IO Text
207
207
tracer = getTrace syncEnv
208
208
209
- backend :: SqlBackend
210
- backend = envDbEnv syncEnv
209
+ dbEnv :: DB. DbEnv
210
+ dbEnv = envDbEnv syncEnv
211
211
212
212
initAction channel = do
213
213
consumedFixed <- getIsConsumedFixed syncEnv
@@ -225,7 +225,7 @@ dbSyncProtocols syncEnv metricsSetters tc codecConfig version bversion =
225
225
(cChainSyncCodec codecs)
226
226
channel
227
227
( Client. chainSyncClientPeer $
228
- chainSyncClientFixConsumed backend syncEnv wrongEntriesSize
228
+ chainSyncClientFixConsumed dbEnv syncEnv wrongEntriesSize
229
229
)
230
230
logInfo tracer $
231
231
mconcat [" Fixed " , textShow fixedEntries, " consumed_by_tx_id wrong entries" ]
@@ -237,15 +237,15 @@ dbSyncProtocols syncEnv metricsSetters tc codecConfig version bversion =
237
237
let onlyFix = soptOnlyFix $ envOptions syncEnv
238
238
if noneFixed fr && (onlyFix || not skipFix)
239
239
then do
240
- fd <- runDbIohkLogging backend tracer $ getWrongPlutusData tracer
240
+ fd <- runDbIohkLogging dbEnv tracer $ getWrongPlutusData tracer
241
241
unless (nullData fd) $
242
242
void $
243
243
runPeer
244
244
localChainSyncTracer
245
245
(cChainSyncCodec codecs)
246
246
channel
247
247
( Client. chainSyncClientPeer $
248
- chainSyncClientFixData backend tracer fd
248
+ chainSyncClientFixData dbEnv tracer fd
249
249
)
250
250
if onlyFix
251
251
then do
@@ -255,15 +255,15 @@ dbSyncProtocols syncEnv metricsSetters tc codecConfig version bversion =
255
255
else
256
256
if isDataFixed fr && (onlyFix || not skipFix)
257
257
then do
258
- ls <- runDbIohkLogging backend tracer $ getWrongPlutusScripts tracer
258
+ ls <- runDbIohkLogging dbEnv tracer $ getWrongPlutusScripts tracer
259
259
unless (nullPlutusScripts ls) $
260
260
void $
261
261
runPeer
262
262
localChainSyncTracer
263
263
(cChainSyncCodec codecs)
264
264
channel
265
265
( Client. chainSyncClientPeer $
266
- chainSyncClientFixScripts backend tracer ls
266
+ chainSyncClientFixScripts dbEnv tracer ls
267
267
)
268
268
when onlyFix $ panic " All Good! This error is only thrown to exit db-sync"
269
269
setIsFixed syncEnv AllFixRan
@@ -464,7 +464,7 @@ drainThePipe n0 client = go n0
464
464
465
465
chainSyncClientFixConsumed ::
466
466
SqlBackend -> SyncEnv -> Word64 -> ChainSyncClient CardanoBlock (Point CardanoBlock ) (Tip CardanoBlock ) IO Integer
467
- chainSyncClientFixConsumed backend syncEnv wrongTotalSize = Client. ChainSyncClient $ do
467
+ chainSyncClientFixConsumed dbEnv syncEnv wrongTotalSize = Client. ChainSyncClient $ do
468
468
liftIO $ logInfo tracer " Starting chainsync to fix consumed_by_tx_id Byron entries. See issue https://github.com/IntersectMBO/cardano-db-sync/issues/1821. This makes resyncing unnecessary."
469
469
pure $ Client. SendMsgFindIntersect [genesisPoint] clientStIntersect
470
470
where
@@ -483,7 +483,7 @@ chainSyncClientFixConsumed backend syncEnv wrongTotalSize = Client.ChainSyncClie
483
483
clientStNext (sizeFixedTotal, (sizeFixEntries, fixEntries)) =
484
484
Client. ClientStNext
485
485
{ Client. recvMsgRollForward = \ blk _tip -> Client. ChainSyncClient $ do
486
- mNewEntries <- fixConsumedBy backend syncEnv blk
486
+ mNewEntries <- fixConsumedBy dbEnv syncEnv blk
487
487
case mNewEntries of
488
488
Nothing -> do
489
489
fixAccumulatedEntries fixEntries
@@ -501,7 +501,7 @@ chainSyncClientFixConsumed backend syncEnv wrongTotalSize = Client.ChainSyncClie
501
501
Client. SendMsgRequestNext (pure () ) (clientStNext (sizeFixedTotal, (sizeFixEntries, fixEntries)))
502
502
}
503
503
504
- fixAccumulatedEntries = fixEntriesConsumed backend tracer . concat . reverse
504
+ fixAccumulatedEntries = fixEntriesConsumed dbEnv tracer . concat . reverse
505
505
506
506
fixAccumulatedEntriesMaybe :: (Integer , [[FixEntry ]]) -> IO (Integer , Integer , [[FixEntry ]])
507
507
fixAccumulatedEntriesMaybe (n, entries)
@@ -516,7 +516,7 @@ chainSyncClientFixConsumed backend syncEnv wrongTotalSize = Client.ChainSyncClie
516
516
517
517
chainSyncClientFixData ::
518
518
SqlBackend -> Trace IO Text -> FixData -> ChainSyncClient CardanoBlock (Point CardanoBlock ) (Tip CardanoBlock ) IO ()
519
- chainSyncClientFixData backend tracer fixData = Client. ChainSyncClient $ do
519
+ chainSyncClientFixData dbEnv tracer fixData = Client. ChainSyncClient $ do
520
520
liftIO $ logInfo tracer " Starting chainsync to fix Plutus Data. This will update database values in tables datum and redeemer_data."
521
521
clientStIdle True (sizeFixData fixData) fixData
522
522
where
@@ -566,7 +566,7 @@ chainSyncClientFixData backend tracer fixData = Client.ChainSyncClient $ do
566
566
clientStNext lastSize fdOnPoint fdRest =
567
567
Client. ClientStNext
568
568
{ Client. recvMsgRollForward = \ blk _tip -> Client. ChainSyncClient $ do
569
- runDbIohkLogging backend tracer $ fixPlutusData tracer blk fdOnPoint
569
+ runDbIohkLogging dbEnv tracer $ fixPlutusData tracer blk fdOnPoint
570
570
clientStIdle False lastSize fdRest
571
571
, Client. recvMsgRollBackward = \ _point _tip ->
572
572
Client. ChainSyncClient $
@@ -576,7 +576,7 @@ chainSyncClientFixData backend tracer fixData = Client.ChainSyncClient $ do
576
576
577
577
chainSyncClientFixScripts ::
578
578
SqlBackend -> Trace IO Text -> FixPlutusScripts -> ChainSyncClient CardanoBlock (Point CardanoBlock ) (Tip CardanoBlock ) IO ()
579
- chainSyncClientFixScripts backend tracer fps = Client. ChainSyncClient $ do
579
+ chainSyncClientFixScripts dbEnv tracer fps = Client. ChainSyncClient $ do
580
580
liftIO $ logInfo tracer " Starting chainsync to fix Plutus Scripts. This will update database values in tables script."
581
581
clientStIdle True (sizeFixPlutusScripts fps) fps
582
582
where
@@ -626,7 +626,7 @@ chainSyncClientFixScripts backend tracer fps = Client.ChainSyncClient $ do
626
626
clientStNext lastSize fpsOnPoint fpsRest =
627
627
Client. ClientStNext
628
628
{ Client. recvMsgRollForward = \ blk _tip -> Client. ChainSyncClient $ do
629
- runDbIohkLogging backend tracer $ fixPlutusScripts tracer blk fpsOnPoint
629
+ runDbIohkLogging dbEnv tracer $ fixPlutusScripts tracer blk fpsOnPoint
630
630
clientStIdle False lastSize fpsRest
631
631
, Client. recvMsgRollBackward = \ _point _tip ->
632
632
Client. ChainSyncClient $
0 commit comments