Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add support for --no-mine with era-test-node #33

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions src/node_bindings/era_test_node.rs
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,7 @@ pub struct EraTestNode {
// // If the block_time is an integer, f64::to_string() will output without a decimal point
// // which allows this to be backwards compatible.
// block_time: Option<f64>,
no_mine: bool,
chain_id: Option<ChainId>,
// TODO
// mnemonic: Option<String>,
Expand Down Expand Up @@ -234,6 +235,12 @@ impl EraTestNode {
// self
// }

/// Sets the no-mine status which will be used when the `era_test_node` instance is launched.
pub const fn no_mine(mut self) -> Self {
self.no_mine = true;
self
}

// TODO
// /// Sets the block-time in sub-seconds which will be used when the `era_test_node` instance is launched.
// /// Older versions of `era_test_node` do not support sub-second block times.
Expand Down Expand Up @@ -319,6 +326,10 @@ impl EraTestNode {
// cmd.arg("-b").arg(block_time.to_string());
// }

if self.no_mine {
cmd.arg("--no-mine");
}

cmd.args(self.args);

if let Some(fork) = self.fork {
Expand Down Expand Up @@ -444,6 +455,11 @@ mod tests {
// let _ = era_test_node.spawn();
// }

#[test]
fn can_launch_era_test_node_with_no_mine() {
let _ = EraTestNode::new().no_mine().spawn();
}

// #[test]
// fn can_launch_era_test_node_with_sub_seconds_block_time() {
// let _ = EraTestNode::new().block_time_f64(0.5).spawn();
Expand Down
Loading