Skip to content
This repository has been archived by the owner on Nov 15, 2023. It is now read-only.

Commit

Permalink
slots: log the actual proposing duration after lenience is applied
Browse files Browse the repository at this point in the history
  • Loading branch information
andresilva committed Jun 19, 2021
1 parent 7d164c4 commit 7996a77
Showing 1 changed file with 20 additions and 15 deletions.
35 changes: 20 additions & 15 deletions client/consensus/slots/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -725,27 +725,32 @@ pub fn proposing_remaining_duration<Block: BlockT>(
};

if let Some(slot_lenience) = slot_lenience {
let lenient_proposing_duration =
proposing_duration + slot_lenience.mul_f32(block_proposal_slot_portion.get());

// if we defined a maximum portion of the slot for proposal then we must make sure the
// lenience doesn't go over it
let lenient_proposing_duration =
if let Some(ref max_block_proposal_slot_portion) = max_block_proposal_slot_portion {
std::cmp::min(
lenient_proposing_duration,
slot_info
.duration
.mul_f32(max_block_proposal_slot_portion.get()),
)
} else {
lenient_proposing_duration
};

debug!(
target: log_target,
"No block for {} slots. Applying {} lenience of {}s",
"No block for {} slots. Applying {} lenience, total proposing duration: {}",
slot_info.slot.saturating_sub(parent_slot + 1),
slot_lenience_type.as_str(),
slot_lenience.as_secs(),
lenient_proposing_duration.as_secs(),
);

let lenient_proposing_duration =
proposing_duration + (slot_lenience.mul_f32(block_proposal_slot_portion.get()));

// if we defined a maximum portion of the slot for proposal then we must make sure the
// lenience doesn't go over it
if let Some(ref max_block_proposal_slot_portion) = max_block_proposal_slot_portion {
std::cmp::min(
lenient_proposing_duration,
slot_info.duration.mul_f32(max_block_proposal_slot_portion.get()),
)
} else {
lenient_proposing_duration
}
lenient_proposing_duration
} else {
proposing_duration
}
Expand Down

0 comments on commit 7996a77

Please sign in to comment.