mirror of
https://github.com/sigp/lighthouse.git
synced 2026-05-30 04:37:13 +00:00
use slot duration from spec
This commit is contained in:
@@ -52,8 +52,9 @@ pub const QUEUED_ATTESTATION_DELAY: Duration = Duration::from_secs(12);
|
|||||||
/// For how long to queue light client updates for re-processing.
|
/// For how long to queue light client updates for re-processing.
|
||||||
pub const QUEUED_LIGHT_CLIENT_UPDATE_DELAY: Duration = Duration::from_secs(12);
|
pub const QUEUED_LIGHT_CLIENT_UPDATE_DELAY: Duration = Duration::from_secs(12);
|
||||||
|
|
||||||
/// For how long to queue gossip data columns awaiting their block for re-processing.
|
/// Data column timeout as a multiplier of slot duration. Columns waiting for their block will be
|
||||||
pub const QUEUED_GOSSIP_DATA_COLUMN_DELAY: Duration = Duration::from_secs(12);
|
/// sent for processing after this many slots worth of time, even if the block hasn't arrived.
|
||||||
|
const QUEUED_DATA_COLUMN_DELAY_SLOTS: u32 = 1;
|
||||||
|
|
||||||
/// Envelope timeout as a multiplier of slot duration. Envelopes waiting for their block will be
|
/// Envelope timeout as a multiplier of slot duration. Envelopes waiting for their block will be
|
||||||
/// sent for processing after this many slots worth of time, even if the block hasn't arrived.
|
/// sent for processing after this many slots worth of time, even if the block hasn't arrived.
|
||||||
@@ -737,9 +738,10 @@ impl<S: SlotClock> ReprocessQueue<S> {
|
|||||||
// Append to existing entry; the timer for this root is already running.
|
// Append to existing entry; the timer for this root is already running.
|
||||||
columns.push(queued_data_column);
|
columns.push(queued_data_column);
|
||||||
} else {
|
} else {
|
||||||
let delay_key = self
|
let delay_key = self.data_columns_delay_queue.insert(
|
||||||
.data_columns_delay_queue
|
block_root,
|
||||||
.insert(block_root, QUEUED_GOSSIP_DATA_COLUMN_DELAY);
|
self.slot_clock.slot_duration() * QUEUED_DATA_COLUMN_DELAY_SLOTS,
|
||||||
|
);
|
||||||
|
|
||||||
self.awaiting_data_columns_per_root
|
self.awaiting_data_columns_per_root
|
||||||
.insert(block_root, (vec![queued_data_column], delay_key));
|
.insert(block_root, (vec![queued_data_column], delay_key));
|
||||||
@@ -1796,7 +1798,11 @@ mod tests {
|
|||||||
);
|
);
|
||||||
|
|
||||||
// Advance time past the delay so the entry expires.
|
// Advance time past the delay so the entry expires.
|
||||||
advance_time(&queue.slot_clock, 2 * QUEUED_GOSSIP_DATA_COLUMN_DELAY).await;
|
advance_time(
|
||||||
|
&queue.slot_clock,
|
||||||
|
2 * queue.slot_clock.slot_duration() * QUEUED_DATA_COLUMN_DELAY_SLOTS,
|
||||||
|
)
|
||||||
|
.await;
|
||||||
let ready_msg = queue.next().await.unwrap();
|
let ready_msg = queue.next().await.unwrap();
|
||||||
assert!(matches!(ready_msg, InboundEvent::ReadyDataColumn(_)));
|
assert!(matches!(ready_msg, InboundEvent::ReadyDataColumn(_)));
|
||||||
queue.handle_message(ready_msg);
|
queue.handle_message(ready_msg);
|
||||||
|
|||||||
Reference in New Issue
Block a user