mirror of
https://github.com/sigp/lighthouse.git
synced 2026-05-30 12:47:05 +00:00
fix tests
This commit is contained in:
@@ -59,14 +59,24 @@ impl TestContext {
|
|||||||
root: Hash256::ZERO,
|
root: Hash256::ZERO,
|
||||||
};
|
};
|
||||||
|
|
||||||
let mut genesis_block = BeaconBlock::empty(&spec);
|
|
||||||
let genesis_state_root = state
|
let genesis_state_root = state
|
||||||
.update_tree_hash_cache()
|
.update_tree_hash_cache()
|
||||||
.expect("should hash genesis state");
|
.expect("should hash genesis state");
|
||||||
|
|
||||||
|
let mut anchor_header = state.latest_block_header().clone();
|
||||||
|
if anchor_header.state_root.is_zero() {
|
||||||
|
anchor_header.state_root = genesis_state_root;
|
||||||
|
}
|
||||||
|
let block_root = anchor_header.canonical_root();
|
||||||
|
|
||||||
|
// Build a signed block with the correct state root for the snapshot.
|
||||||
|
let mut genesis_block = BeaconBlock::empty(&spec);
|
||||||
*genesis_block.state_root_mut() = genesis_state_root;
|
*genesis_block.state_root_mut() = genesis_state_root;
|
||||||
let signed_block = SignedBeaconBlock::from_block(genesis_block, Signature::empty());
|
let signed_block = SignedBeaconBlock::from_block(genesis_block, Signature::empty());
|
||||||
let block_root = signed_block.canonical_root();
|
|
||||||
|
|
||||||
|
let _ = store
|
||||||
|
.init_anchor_info(Hash256::ZERO, Slot::new(0), Slot::new(0), false)
|
||||||
|
.expect("should init anchor info");
|
||||||
store
|
store
|
||||||
.put_state(&genesis_state_root, &state)
|
.put_state(&genesis_state_root, &state)
|
||||||
.expect("should persist genesis state");
|
.expect("should persist genesis state");
|
||||||
|
|||||||
@@ -2925,7 +2925,7 @@ impl ApiTester {
|
|||||||
.expect("slot index should be in lookahead") as usize;
|
.expect("slot index should be in lookahead") as usize;
|
||||||
|
|
||||||
let preferences = ProposerPreferences {
|
let preferences = ProposerPreferences {
|
||||||
dependent_root: Hash256::ZERO,
|
dependent_root: head.beacon_block_root,
|
||||||
proposal_slot,
|
proposal_slot,
|
||||||
validator_index: validator_index as u64,
|
validator_index: validator_index as u64,
|
||||||
fee_recipient: Address::repeat_byte(0xaa),
|
fee_recipient: Address::repeat_byte(0xaa),
|
||||||
|
|||||||
Reference in New Issue
Block a user