mirror of
https://github.com/status-im/eth2.0-specs.git
synced 2025-01-11 11:14:17 +00:00
Ensure light client optimistic_header
to be at head
When a light client updates its `finalized_header` using a forced update because of the timeout, and the new header was not signed by enough sync committee participants to pass `get_safety_threshold(store)`, it may occur that `store.finalized_header.slot > store.optimistic_header.slot`. This patch ensures that the `optimistic_header` is updated to the latest `finalized_header` if that happens, so that it always indicates the latest known and accepted head.
This commit is contained in:
parent
2232d76735
commit
0e9460b8dd
@ -214,6 +214,8 @@ def apply_light_client_update(store: LightClientStore, update: LightClientUpdate
|
|||||||
store.current_sync_committee = store.next_sync_committee
|
store.current_sync_committee = store.next_sync_committee
|
||||||
store.next_sync_committee = update.next_sync_committee
|
store.next_sync_committee = update.next_sync_committee
|
||||||
store.finalized_header = active_header
|
store.finalized_header = active_header
|
||||||
|
if store.finalized_header.slot > store.optimistic_header.slot:
|
||||||
|
store.optimistic_header = store.finalized_header
|
||||||
```
|
```
|
||||||
|
|
||||||
#### `process_light_client_update`
|
#### `process_light_client_update`
|
||||||
|
Loading…
x
Reference in New Issue
Block a user