Skip to content

Commit

Permalink
Adding comments about configuring mine rates
Browse files Browse the repository at this point in the history
  • Loading branch information
bjohnson5 committed Dec 20, 2024
1 parent 9fa117a commit 664da71
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion blast_core/src/blast_event_manager.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,15 @@ use anyhow::Error;
use tokio::sync::mpsc::Sender;
use serde::{Serialize, Deserialize};

// TODO: Make this configurable
/// The number of seconds to wait in between checking for events
pub const FRAME_RATE: u64 = 1;

// TODO: Make this configurable (might be useful to make it zero if you do not want new blocks during the sim)
/// The number of seconds in between mining events
pub const MINE_RATE: u64 = 5;

// TODO: Make this configurable (might be useful to make it zero if you do not want new blocks during the sim)
/// The number of blocks to mine for each mining event
pub const BLOCKS_PER_MINE: u64 = 10;

Expand Down Expand Up @@ -86,7 +89,7 @@ impl BlastEventManager {
log::info!("BlastEventManager running frame number {}", frame);

// If it is time to mine new bocks, use the bitcoind RPC client to generate new blocks
if frame % MINE_RATE == 0 {
if MINE_RATE != 0 && BLOCKS_PER_MINE != 0 && frame % MINE_RATE == 0 {
match crate::mine_blocks(&mut self.bitcoin_rpc, BLOCKS_PER_MINE) {
Ok(_) => {},
Err(e) => return Err(anyhow::Error::msg(e)),
Expand Down

0 comments on commit 664da71

Please sign in to comment.