mirror of
https://github.com/sigp/lighthouse.git
synced 2026-03-02 16:21:42 +00:00
fix(peerdb): use start_slot instead of end_slot for safer actions (#8498)
Which issue # does this PR address? None Discussed in private with @jimmygchen, Lighthouse's `earliest_available_slot` is guaranteed to always align with epoch boundaries, but as a safety implementation, we should use `start_slot` just in case other clients differ in their implementations. At least we agreed it would be safer for `synced_peers_for_epoch`, I also made the change in `has_good_custody_range_sync_peer`, but this is to be reviewed please. Co-Authored-By: Antoine James <antoine@ethereum.org> Co-Authored-By: Jimmy Chen <jimmy@sigmaprime.io>
This commit is contained in:
@@ -259,10 +259,10 @@ impl<E: EthSpec> PeerDB<E> {
|
|||||||
info.is_connected()
|
info.is_connected()
|
||||||
&& match info.sync_status() {
|
&& match info.sync_status() {
|
||||||
SyncStatus::Synced { info } => {
|
SyncStatus::Synced { info } => {
|
||||||
info.has_slot(epoch.end_slot(E::slots_per_epoch()))
|
info.has_slot(epoch.start_slot(E::slots_per_epoch()))
|
||||||
}
|
}
|
||||||
SyncStatus::Advanced { info } => {
|
SyncStatus::Advanced { info } => {
|
||||||
info.has_slot(epoch.end_slot(E::slots_per_epoch()))
|
info.has_slot(epoch.start_slot(E::slots_per_epoch()))
|
||||||
}
|
}
|
||||||
SyncStatus::IrrelevantPeer
|
SyncStatus::IrrelevantPeer
|
||||||
| SyncStatus::Behind { .. }
|
| SyncStatus::Behind { .. }
|
||||||
@@ -332,7 +332,7 @@ impl<E: EthSpec> PeerDB<E> {
|
|||||||
info.is_connected()
|
info.is_connected()
|
||||||
&& match info.sync_status() {
|
&& match info.sync_status() {
|
||||||
SyncStatus::Synced { info } | SyncStatus::Advanced { info } => {
|
SyncStatus::Synced { info } | SyncStatus::Advanced { info } => {
|
||||||
info.has_slot(epoch.end_slot(E::slots_per_epoch()))
|
info.has_slot(epoch.start_slot(E::slots_per_epoch()))
|
||||||
}
|
}
|
||||||
SyncStatus::IrrelevantPeer
|
SyncStatus::IrrelevantPeer
|
||||||
| SyncStatus::Behind { .. }
|
| SyncStatus::Behind { .. }
|
||||||
|
|||||||
Reference in New Issue
Block a user