2023-03-02 09:57:58 +00:00
|
|
|
# Nimbus
|
2024-04-19 18:37:27 +00:00
|
|
|
# Copyright (c) 2021-2024 Status Research & Development GmbH
|
2023-03-02 09:57:58 +00:00
|
|
|
# Licensed and distributed under either of
|
|
|
|
# * MIT license (license terms in the root directory or at
|
|
|
|
# https://opensource.org/licenses/MIT).
|
|
|
|
# * Apache v2 license (license terms in the root directory or at
|
|
|
|
# https://www.apache.org/licenses/LICENSE-2.0).
|
|
|
|
# at your option. This file may not be copied, modified, or distributed
|
|
|
|
# except according to those terms.
|
|
|
|
|
|
|
|
{.push raises:[].}
|
|
|
|
|
|
|
|
import
|
|
|
|
eth/p2p,
|
|
|
|
chronos,
|
2024-04-19 18:37:27 +00:00
|
|
|
../../db/aristo/aristo_desc,
|
2023-03-02 09:57:58 +00:00
|
|
|
../sync_desc,
|
2023-04-24 20:24:07 +00:00
|
|
|
../misc/[best_pivot, block_queue, ticker]
|
2023-03-02 09:57:58 +00:00
|
|
|
|
|
|
|
type
|
|
|
|
PivotState* = enum
|
|
|
|
PivotStateInitial, ## Initial state
|
|
|
|
FirstPivotSeen, ## Starting, first pivot seen
|
|
|
|
FirstPivotAccepted, ## Accepted, waiting for second
|
|
|
|
FirstPivotUseRegardless ## Force pivot if available
|
|
|
|
PivotRunMode ## SNAFU after some magic
|
|
|
|
|
2023-03-03 20:01:59 +00:00
|
|
|
FullBuddyData* = object
|
2023-03-02 09:57:58 +00:00
|
|
|
## Local descriptor data extension
|
|
|
|
pivot*: BestPivotWorkerRef ## Local pivot worker descriptor
|
|
|
|
bQueue*: BlockQueueWorkerRef ## Block queue worker
|
|
|
|
|
2023-03-03 20:01:59 +00:00
|
|
|
FullCtxData* = object
|
2023-03-02 09:57:58 +00:00
|
|
|
## Globally shared data extension
|
|
|
|
rng*: ref HmacDrbgContext ## Random generator, pre-initialised
|
|
|
|
pivot*: BestPivotCtxRef ## Global pivot descriptor
|
|
|
|
pivotState*: PivotState ## For initial pivot control
|
|
|
|
pivotStamp*: Moment ## `PivotState` driven timing control
|
|
|
|
bCtx*: BlockQueueCtxRef ## Global block queue descriptor
|
|
|
|
suspendAt*: BlockNumber ## Suspend if persistent head is larger
|
2023-04-24 20:24:07 +00:00
|
|
|
|
|
|
|
enableTicker*: bool ## Advisary, extra level of gossip
|
2023-03-02 09:57:58 +00:00
|
|
|
ticker*: TickerRef ## Logger ticker
|
2024-04-19 18:37:27 +00:00
|
|
|
journal*: QidSchedRef ## Journal access for logging (if any)
|
2023-03-02 09:57:58 +00:00
|
|
|
|
2023-03-03 20:01:59 +00:00
|
|
|
FullBuddyRef* = BuddyRef[FullCtxData,FullBuddyData]
|
2023-03-02 09:57:58 +00:00
|
|
|
## Extended worker peer descriptor
|
|
|
|
|
2023-03-03 20:01:59 +00:00
|
|
|
FullCtxRef* = CtxRef[FullCtxData]
|
2023-03-02 09:57:58 +00:00
|
|
|
## Extended global descriptor
|
|
|
|
|
|
|
|
# End
|