mirror of
https://github.com/status-im/nimbus-eth2.git
synced 2025-02-05 03:03:26 +00:00
fix block pool finalization point init
This commit is contained in:
parent
7781536576
commit
d9c98b15c8
@ -206,7 +206,7 @@ proc init*(T: type BlockPool, db: BeaconChainDB): BlockPool =
|
|||||||
tmpState[] = db.getState(latestStateRoot.get().stateRoot)
|
tmpState[] = db.getState(latestStateRoot.get().stateRoot)
|
||||||
let
|
let
|
||||||
finalizedSlot =
|
finalizedSlot =
|
||||||
tmpState[].get().current_justified_checkpoint.epoch.compute_start_slot_at_epoch()
|
tmpState[].get().finalized_checkpoint.epoch.compute_start_slot_at_epoch()
|
||||||
finalizedHead = headRef.findAncestorBySlot(finalizedSlot)
|
finalizedHead = headRef.findAncestorBySlot(finalizedSlot)
|
||||||
justifiedSlot =
|
justifiedSlot =
|
||||||
tmpState[].get().current_justified_checkpoint.epoch.compute_start_slot_at_epoch()
|
tmpState[].get().current_justified_checkpoint.epoch.compute_start_slot_at_epoch()
|
||||||
|
@ -221,3 +221,17 @@ when const_preset == "minimal": # Too much stack space used on mainnet
|
|||||||
pool.heads.len() == 1
|
pool.heads.len() == 1
|
||||||
pool.head.justified.slot.compute_epoch_at_slot() == 5
|
pool.head.justified.slot.compute_epoch_at_slot() == 5
|
||||||
pool.tail.children.len == 1
|
pool.tail.children.len == 1
|
||||||
|
|
||||||
|
let
|
||||||
|
pool2 = BlockPool.init(db)
|
||||||
|
|
||||||
|
# check that the state reloaded from database resembles what we had before
|
||||||
|
check:
|
||||||
|
pool2.tail.root == pool.tail.root
|
||||||
|
pool2.head.blck.root == pool.head.blck.root
|
||||||
|
pool2.finalizedHead.blck.root == pool.finalizedHead.blck.root
|
||||||
|
pool2.finalizedHead.slot == pool.finalizedHead.slot
|
||||||
|
hash_tree_root(pool2.headState.data.data) ==
|
||||||
|
hash_tree_root(pool.headState.data.data)
|
||||||
|
hash_tree_root(pool2.justifiedState.data.data) ==
|
||||||
|
hash_tree_root(pool.justifiedState.data.data)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user