Sync finalized sync to 2 epochs + 1 slot past our peer's finalized slot in order to finalize the chain locally
This commit is contained in:
parent
dfbe4b1add
commit
d1146ec8b5
@ -142,13 +142,20 @@ where
|
|||||||
debug!(self.log, "Finalization sync peer joined"; "peer_id" => %peer_id);
|
debug!(self.log, "Finalization sync peer joined"; "peer_id" => %peer_id);
|
||||||
self.awaiting_head_peers.remove(&peer_id);
|
self.awaiting_head_peers.remove(&peer_id);
|
||||||
|
|
||||||
|
// Because of our change in finalized sync batch size from 2 to 1 and our transition
|
||||||
|
// to using exact epoch boundaries for batches (rather than one slot past the epoch
|
||||||
|
// boundary), we need to sync finalized sync to 2 epochs + 1 slot past our peer's
|
||||||
|
// finalized slot in order to finalize the chain locally.
|
||||||
|
let target_head_slot =
|
||||||
|
remote_finalized_slot + (2 * T::EthSpec::slots_per_epoch()) + 1;
|
||||||
|
|
||||||
// Note: We keep current head chains. These can continue syncing whilst we complete
|
// Note: We keep current head chains. These can continue syncing whilst we complete
|
||||||
// this new finalized chain.
|
// this new finalized chain.
|
||||||
|
|
||||||
self.chains.add_peer_or_create_chain(
|
self.chains.add_peer_or_create_chain(
|
||||||
local_info.finalized_epoch,
|
local_info.finalized_epoch,
|
||||||
remote_info.finalized_root,
|
remote_info.finalized_root,
|
||||||
remote_finalized_slot,
|
target_head_slot,
|
||||||
peer_id,
|
peer_id,
|
||||||
RangeSyncType::Finalized,
|
RangeSyncType::Finalized,
|
||||||
network,
|
network,
|
||||||
|
Loading…
Reference in New Issue
Block a user