File tree Expand file tree Collapse file tree 1 file changed +18
-7
lines changed Expand file tree Collapse file tree 1 file changed +18
-7
lines changed Original file line number Diff line number Diff line change @@ -88,13 +88,6 @@ func init*[T](
8888 columnsMap: Opt .some (columns)
8989 )
9090
91- proc init * (
92- t: typedesc [SyncDag ],
93- A: typedesc ,
94- B: typedesc
95- ): SyncDag [A, B] =
96- SyncDag [A, B]()
97-
9891iterator parents * (entry: SyncDagEntryRef ): SyncDagEntryRef =
9992 doAssert (not (isNil (entry)), " Entry should not be nil" )
10093 var currentEntry = entry
@@ -283,3 +276,21 @@ proc prune*[A, B](
283276 if sdag.roots.pop (item, entry):
284277 entry.parent = nil
285278 entry = nil
279+
280+ proc init * (
281+ t: typedesc [SyncDag ],
282+ A: typedesc ,
283+ B: typedesc
284+ ): SyncDag [A, B] =
285+ var res = SyncDag [A, B]()
286+ let
287+ genesisRoot =
288+ Eth2Digest ()
289+ genesisBid =
290+ BlockId (root: genesisRoot, slot: GENESIS_SLOT )
291+ genesisEntry =
292+ SyncDagEntryRef (blockId: genesisBid, flags: {DagEntryFlag .Finalized })
293+ res.roots[genesisRoot] = genesisEntry
294+ res.slots[GENESIS_SLOT ] = toHashSet (@ [genesisRoot])
295+ res.lastSlot = GENESIS_SLOT
296+ res
You can’t perform that action at this time.
0 commit comments