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