mirror of
https://github.com/sigp/lighthouse.git
synced 2026-03-15 19:02:42 +00:00
Ensure batches align to epoch boundaries (#1021)
* Ensure batches align to epoch boundaries * Clean up range_sync logs
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
use super::chain::BLOCKS_PER_BATCH;
|
||||
use super::chain::EPOCHS_PER_BATCH;
|
||||
use eth2_libp2p::rpc::methods::*;
|
||||
use eth2_libp2p::rpc::RequestId;
|
||||
use eth2_libp2p::PeerId;
|
||||
@@ -76,7 +76,10 @@ impl<T: EthSpec> Batch<T> {
|
||||
pub fn to_blocks_by_range_request(&self) -> BlocksByRangeRequest {
|
||||
BlocksByRangeRequest {
|
||||
start_slot: self.start_slot.into(),
|
||||
count: std::cmp::min(BLOCKS_PER_BATCH, self.end_slot.sub(self.start_slot).into()),
|
||||
count: std::cmp::min(
|
||||
T::slots_per_epoch() * EPOCHS_PER_BATCH,
|
||||
self.end_slot.sub(self.start_slot).into(),
|
||||
),
|
||||
step: 1,
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user