mirror of
https://github.com/status-im/nimbus-eth1.git
synced 2025-01-12 05:14:14 +00:00
clique: connect period and epoch from chain_config to engine
transfer cliquePeriod and cliqueEpoch from chain_config to PoA engine.
This commit is contained in:
parent
87b54b3321
commit
7972e7a55c
@ -19,7 +19,7 @@
|
||||
##
|
||||
|
||||
import
|
||||
std/[sequtils],
|
||||
std/[sequtils, times],
|
||||
../db/db_chain,
|
||||
./clique/[clique_cfg, clique_defs, clique_desc, clique_verify],
|
||||
./clique/snapshot/[ballot, snapshot_desc],
|
||||
@ -49,8 +49,17 @@ type
|
||||
proc newClique*(db: BaseChainDB): Clique =
|
||||
## Constructor for a new Clique proof-of-authority consensus engine. The
|
||||
## initial state of the engine is `empty`, there are no authorised signers.
|
||||
db.newCliqueCfg.newClique
|
||||
##
|
||||
## If chain_config provides `Period` or `Epoch`, then `Period` or `Epoch`
|
||||
## will be taken from chain_config. Otherwise, default value in `newCliqueCfg`
|
||||
## will be used
|
||||
|
||||
let cfg = db.newCliqueCfg
|
||||
if db.config.cliquePeriod > 0:
|
||||
cfg.period = initDuration(seconds = db.config.cliquePeriod)
|
||||
if db.config.cliqueEpoch > 0:
|
||||
cfg.epoch = db.config.cliqueEpoch
|
||||
cfg.newClique
|
||||
|
||||
proc cliqueSave*(c: var Clique): CliqueState =
|
||||
## Save current `Clique` state. This state snapshot saves the internal
|
||||
|
Loading…
x
Reference in New Issue
Block a user