Connect gasLimit from Config to CommonRef (#2946)

This commit is contained in:
andri lim 2024-12-17 17:48:31 +07:00 committed by GitHub
parent 0b704040e3
commit f74813520a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 17 additions and 5 deletions

View File

@ -476,6 +476,11 @@ func `extraData=`*(com: CommonRef, val: string) =
com.extraData = val
func `gasLimit=`*(com: CommonRef, val: uint64) =
if val < GAS_LIMIT_MINIMUM:
com.gasLimit = GAS_LIMIT_MINIMUM
elif val > GAS_LIMIT_MAXIMUM:
com.gasLimit = GAS_LIMIT_MAXIMUM
else:
com.gasLimit = val
# ------------------------------------------------------------------------------

View File

@ -468,7 +468,6 @@ proc assembleBlock*(
## tuning parameters. The following block header fields are left
## uninitialised:
##
## * *extraData*: Blob
## * *mixHash*: Hash32
## * *nonce*: BlockNonce
##

View File

@ -221,14 +221,14 @@ proc run(nimbus: NimbusNode, conf: NimbusConf) =
try:
if conf.numThreads < 0:
fatal "The number of threads --num-threads cannot be negative."
quit 1
quit QuitFailure
elif conf.numThreads == 0:
Taskpool.new(numThreads = min(countProcessors(), 16))
else:
Taskpool.new(numThreads = conf.numThreads)
except CatchableError as e:
fatal "Cannot start taskpool", err = e.msg
quit 1
quit QuitFailure
info "Threadpool started", numThreads = taskpool.numThreads
@ -244,7 +244,15 @@ proc run(nimbus: NimbusNode, conf: NimbusConf) =
extraData=conf.extraData,
len=conf.extraData.len
if conf.gasLimit > GAS_LIMIT_MAXIMUM or
conf.gasLimit < GAS_LIMIT_MINIMUM:
warn "GasLimit not in expected range, truncate",
min=GAS_LIMIT_MINIMUM,
max=GAS_LIMIT_MAXIMUM,
get=conf.gasLimit
com.extraData = conf.extraData
com.gasLimit = conf.gasLimit
defer:
com.db.finish()