Skip to content

Commit

Permalink
fix(collator): drop accumulated used wu when no pending messages
Browse files Browse the repository at this point in the history
  • Loading branch information
SmaGMan committed Dec 9, 2024
1 parent 604d035 commit ba5dac0
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion collator/src/collator/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1675,6 +1675,9 @@ impl CollatorStdImpl {
last_imported_chain_time,
"there are no pending internals or externals, will import next anchor",
);

// drop used wu when anchor was not imported by used wu
working_state.wu_used_from_last_anchor = 0;
}
(_, _, true) => {
tracing::info!(target: tracing_targets::COLLATOR,
Expand Down Expand Up @@ -1773,14 +1776,15 @@ impl CollatorStdImpl {

imported_anchors_has_externals |= has_our_externals;

// reduce used wu by one imported anchor
working_state.wu_used_from_last_anchor = working_state
.wu_used_from_last_anchor
.saturating_sub(wu_used_to_import_next_anchor);

tracing::debug!(target: tracing_targets::COLLATOR,
wu_used_from_last_anchor = working_state.wu_used_from_last_anchor,
force_import_anchor_by_used_wu,
"wu_used_from_last_anchor dropped to",
"used wu dropped to",
);

if working_state.wu_used_from_last_anchor
Expand Down

0 comments on commit ba5dac0

Please sign in to comment.