|
6 | 6 | # at your option. This file may not be copied, modified, or distributed except according to those terms. |
7 | 7 | {.push raises: [].} |
8 | 8 |
|
9 | | -import std/[sets, tables, strutils, sequtils] |
| 9 | +import std/[sets, tables, strutils] |
10 | 10 | import stew/base10, chronos, chronicles, results |
11 | 11 | import ../spec/[forks, block_id] |
12 | 12 | import ./[sync_queue] |
|
20 | 20 | parent*: SyncDagEntryRef |
21 | 21 | flags*: set[DagEntryFlag] |
22 | 22 |
|
23 | | - BlockLogEntry* = object |
24 | | - slot*: Slot |
25 | | - root*: Eth2Digest |
26 | | - parent_root*: Eth2Digest |
27 | | - |
28 | 23 | PeerEntryRef*[A] = ref object |
29 | 24 | peer*: A |
30 | 25 | pendingRoots*: Deque[Eth2Digest] |
31 | | - rootsLog*: seq[BlockLogEntry] |
32 | 26 | maxBlocksPerRequest*: int |
33 | 27 | maxSidecarsPerRequest*: int |
34 | 28 | peerLoopFut*: Future[void].Raising([]) |
|
42 | 36 | const |
43 | 37 | EmptyBlockId* = BlockId(slot: FAR_FUTURE_SLOT) |
44 | 38 |
|
45 | | -func toLogEntry*(blck: ref ForkedSignedBeaconBlock): BlockLogEntry = |
46 | | - withBlck(blck[]): |
47 | | - BlockLogEntry( |
48 | | - slot: forkyBlck.message.slot, |
49 | | - root: forkyBlck.root, |
50 | | - parent_root: forkyBlck.message.parent_root) |
51 | | - |
52 | | -func shortLog*(entry: BlockLogEntry): string = |
53 | | - "(slot: " & $entry.slot & ", root: " & shortLog(entry.root) & |
54 | | - ", parent_root: " & shortLog(entry.parent_root) & ")" |
55 | | - |
56 | | -func shortLog*(entries: openArray[BlockLogEntry]): string = |
57 | | - "[" & entries.mapIt(shortLog(it)).join(",") & "]" |
58 | | - |
59 | 39 | func toBlockId*(checkpoint: Checkpoint): BlockId = |
60 | 40 | BlockId(root: checkpoint.root, slot: checkpoint.epoch.start_slot()) |
61 | 41 |
|
|
0 commit comments