Use genesis slot for node/syncing (#3226)

## Issue Addressed

NA

## Proposed Changes

Resolves this error log emitted from the VC prior to genesis:

```
WARN Unable connect to beacon node           error: ServerMessage(ErrorMessage { code: 500, message: "UNHANDLED_ERROR: UnableToReadSlot", stacktraces: [] })
```

## Additional Info

NA
This commit is contained in:
Paul Hauner 2022-05-31 06:09:11 +00:00
parent 98c8ac1a87
commit 16e49af8e1

View File

@ -1737,9 +1737,9 @@ pub fn serve<T: BeaconChainTypes>(
.head_info() .head_info()
.map(|info| info.slot) .map(|info| info.slot)
.map_err(warp_utils::reject::beacon_chain_error)?; .map_err(warp_utils::reject::beacon_chain_error)?;
let current_slot = chain let current_slot = chain.slot_clock.now_or_genesis().ok_or_else(|| {
.slot() warp_utils::reject::custom_server_error("Unable to read slot clock".into())
.map_err(warp_utils::reject::beacon_chain_error)?; })?;
// Taking advantage of saturating subtraction on slot. // Taking advantage of saturating subtraction on slot.
let sync_distance = current_slot - head_slot; let sync_distance = current_slot - head_slot;