Disable sealing engine when beacon engine takes it place.

This commit is contained in:
jangko 2023-08-30 21:14:38 +07:00
parent 0b0d478966
commit 57a22bbfab
No known key found for this signature in database
GPG Key ID: 31702AE10541E6B9
1 changed files with 10 additions and 13 deletions

View File

@ -350,19 +350,16 @@ proc localServices(nimbus: NimbusNode, conf: NimbusConf,
nimbus.chainRef.clique.authorize(conf.engineSigner, signFunc)
# always create sealing engine instance but not always run it
# e.g. engine api need sealing engine without it running
var initialState = EngineStopped
if com.forkGTE(MergeFork):
initialState = EnginePostMerge
nimbus.sealingEngine = SealingEngineRef.new(
nimbus.chainRef, nimbus.ctx, conf.engineSigner,
nimbus.txPool, initialState
)
# disable sealing engine if beacon engine enabled
if not com.forkGTE(MergeFork):
nimbus.sealingEngine = SealingEngineRef.new(
nimbus.chainRef, nimbus.ctx, conf.engineSigner,
nimbus.txPool, EngineStopped
)
# only run sealing engine if there is a signer
if conf.engineSigner != ZERO_ADDRESS:
nimbus.sealingEngine.start()
# only run sealing engine if there is a signer
if conf.engineSigner != ZERO_ADDRESS:
nimbus.sealingEngine.start()
if conf.engineApiEnabled:
#let maybeAsyncDataSource = maybeStatelessAsyncDataSource(nimbus, conf)
@ -465,7 +462,7 @@ proc stop*(nimbus: NimbusNode, conf: NimbusConf) {.async, gcsafe.} =
nimbus.engineApiWsServer.stop()
if conf.graphqlEnabled:
await nimbus.graphqlServer.stop()
if conf.engineSigner != ZERO_ADDRESS:
if conf.engineSigner != ZERO_ADDRESS and nimbus.sealingEngine.isNil.not:
await nimbus.sealingEngine.stop()
if conf.maxPeers > 0:
await nimbus.networkLoop.cancelAndWait()