Skip to content

Commit

Permalink
Rate-limit template changes in the receiver
Browse files Browse the repository at this point in the history
  • Loading branch information
teor2345 committed Jan 9, 2024
1 parent 9657302 commit 4edc15e
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions zebrad/src/components/miner.rs
Original file line number Diff line number Diff line change
Expand Up @@ -375,6 +375,13 @@ where
"solver cancelled: getting a new block template or shutting down"
);
}

// If the blockchain is changing rapidly, limit how often we'll update the template.
// But if we're shutting down, do that immediately.
if template_receiver.has_changed().is_ok() && !is_shutting_down() {
sleep(Duration::from_secs(1)).await;
}

continue;
};

Expand Down

0 comments on commit 4edc15e

Please sign in to comment.