@@ -329,7 +329,7 @@ withChainwebInternal conf logger peerRes serviceSock rocksDb defaultPactDbDir ba
329329 { _cutDbParamsLogLevel = Info
330330 , _cutDbParamsTelemetryLevel = Info
331331 , _cutDbParamsInitialHeightLimit = _cutInitialBlockHeightLimit cutConf
332- , _cutDbParamsReadOnly = _configReadOnlyReplay conf
332+ , _cutDbParamsReadOnly = False
333333 , _cutDbParamsInitialCutFile = _cutInitialCutFile cutConf
334334 }
335335 where
@@ -388,93 +388,42 @@ withChainwebInternal conf logger peerRes serviceSock rocksDb defaultPactDbDir ba
388388 mempoolThrottler <- mkMempoolThrottler $ _throttlingMempoolRate throt
389389 logg Debug " initialized throttlers"
390390
391- -- synchronize pact dbs with latest cut before we start the server
392- -- and clients and begin mining.
393- --
394- -- This is a consistency check that validates the blocks in the
395- -- current cut. If it fails an exception is raised. Also, if it
396- -- takes long (for example, when doing a reset to a prior block
397- -- height) we want this to happen before we go online.
398- --
399- let
400- -- pactSyncChains =
401- -- case _configSyncPactChains conf of
402- -- Just syncChains
403- -- | _configReadOnlyReplay conf
404- -- -> HM.filterWithKey (\k _ -> elem k syncChains) cs
405- -- _ -> cs
406-
407- if _configReadOnlyReplay conf
408- then do
409- -- FIXME implement replay in payload provider
410- error " Chainweb.Chainweb.withChainwebInternal: pact replay is not supported"
411- -- logFunctionJson logger Info PactReplayInProgress
412- -- -- note that we don't use the "initial cut" from cutdb because its height depends on initialBlockHeightLimit.
413- -- highestCut <-
414- -- unsafeMkCut v <$> readHighestCutHeaders v (logFunctionText logger) webchain (cutHashesTable rocksDb)
415- -- lowerBoundCut <-
416- -- tryLimitCut webchain (fromMaybe 0 $ _cutInitialBlockHeightLimit $ _configCuts conf) highestCut
417- -- upperBoundCut <- forM (_cutFastForwardBlockHeightLimit $ _configCuts conf) $ \upperBound ->
418- -- tryLimitCut webchain upperBound highestCut
419- -- let
420- -- replayOneChain :: (ChainResources logger, (BlockHeader, Maybe BlockHeader)) -> IO ()
421- -- replayOneChain (cr, (l, u)) = do
422- -- let chainPact = _chainResPact cr
423- -- let logCr = logFunctionText
424- -- $ addLabel ("component", "pact")
425- -- $ addLabel ("sub-component", "init")
426- -- $ _chainResLogger cr
427- -- void $ _pactReadOnlyReplay chainPact l u
428- -- logCr Info "pact db synchronized"
429- -- let bounds =
430- -- HM.intersectionWith (,)
431- -- pactSyncChains
432- -- (HM.mapWithKey
433- -- (\cid bh ->
434- -- (bh, (HM.! cid) . _cutMap <$> upperBoundCut))
435- -- (_cutMap lowerBoundCut)
436- -- )
437- -- mapConcurrently_ replayOneChain bounds
438- -- logg Info "finished fast forward replay"
439- -- logFunctionJson logger Info PactReplaySuccessful
440- -- inner $ Replayed lowerBoundCut upperBoundCut
441- else do
442- logg Debug " start initializing miner resources"
443- logFunctionJson logger Info InitializingMinerResources
444-
445- withMiningCoordination mLogger mConf mCutDb $ \ mc ->
446-
447- -- Miner resources are used by the test-miner when in-node
448- -- mining is configured or by the mempool noop-miner (which
449- -- keeps the mempool updated) in production setups.
450- --
451- withMinerResources mLogger (_miningInNode mConf) cs mCutDb mc $ \ m -> do
452- logFunctionJson logger Info ChainwebStarted
453- logg Debug " finished initializing miner resources"
454- let ! haddr = _peerConfigAddr $ _p2pConfigPeer $ _configP2p conf
455- inner $ StartedChainweb Chainweb
456- { _chainwebHostAddress = haddr
457- , _chainwebChains = cs
458- , _chainwebCutResources = cutResources
459- , _chainwebMiner = m
460- , _chainwebCoordinator = mc
461- , _chainwebLogger = logger
462- , _chainwebPeer = peerRes
463- , _chainwebManager = mgr
464- -- , _chainwebPactData = pactData
465- , _chainwebThrottler = throttler
466- , _chainwebPutPeerThrottler = putPeerThrottler
467- , _chainwebMempoolThrottler = mempoolThrottler
468- , _chainwebConfig = conf
469- , _chainwebServiceSocket = serviceSock
470- , _chainwebBackup = BackupEnv
471- { _backupRocksDb = rocksDb
472- , _backupDir = backupDir
473- , _backupPactDbDir = defaultPactDbDir
474- , _backupChainIds = cids
475- , _backupLogger = backupLogger
476- }
477- }
391+ logg Debug " start initializing miner resources"
392+ logFunctionJson logger Info InitializingMinerResources
393+
394+ withMiningCoordination mLogger mConf mCutDb $ \ mc ->
395+
396+ -- Miner resources are used by the test-miner when in-node
397+ -- mining is configured or by the mempool noop-miner (which
398+ -- keeps the mempool updated) in production setups.
399+ --
400+ withMinerResources mLogger (_miningInNode mConf) cs mCutDb mc $ \ m -> do
401+ logFunctionJson logger Info ChainwebStarted
402+ logg Debug " finished initializing miner resources"
403+ let ! haddr = _peerConfigAddr $ _p2pConfigPeer $ _configP2p conf
404+ inner $ StartedChainweb Chainweb
405+ { _chainwebHostAddress = haddr
406+ , _chainwebChains = cs
407+ , _chainwebCutResources = cutResources
408+ , _chainwebMiner = m
409+ , _chainwebCoordinator = mc
410+ , _chainwebLogger = logger
411+ , _chainwebPeer = peerRes
412+ , _chainwebManager = mgr
413+ -- , _chainwebPactData = pactData
414+ , _chainwebThrottler = throttler
415+ , _chainwebPutPeerThrottler = putPeerThrottler
416+ , _chainwebMempoolThrottler = mempoolThrottler
417+ , _chainwebConfig = conf
418+ , _chainwebServiceSocket = serviceSock
419+ , _chainwebBackup = BackupEnv
420+ { _backupRocksDb = rocksDb
421+ , _backupDir = backupDir
422+ , _backupPactDbDir = defaultPactDbDir
423+ , _backupChainIds = cids
424+ , _backupLogger = backupLogger
425+ }
426+ }
478427
479428 -- synchronizePactDb :: HM.HashMap ChainId (ChainResources logger) -> Cut -> IO ()
480429 -- synchronizePactDb cs targetCut = do
0 commit comments