Skip to content

Commit

Permalink
optimize tx success criteria
Browse files Browse the repository at this point in the history
  • Loading branch information
miralandlabs committed May 2, 2024
1 parent 6c6e79b commit c5fc847
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 4 deletions.
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "mars-cli"
version = "0.5.4"
version = "0.5.5"
description = "A command line interface for the Mars program."
license = "Apache-2.0"
edition = "2021"
Expand Down
7 changes: 6 additions & 1 deletion src/mine.rs
Original file line number Diff line number Diff line change
Expand Up @@ -116,14 +116,19 @@ impl Miner {
}
break;
}
Err(_err) => {
Err(err) => {
// TODO
// MI
println!("Failure: {:?}", err);
}
}
}
}
}

// TODO
// In extreme case, all running miners could be stuck in loop and waiting forever
// Temp solution: some miner exit (ctrl-c) and start over mining
async fn find_bus_id(&self, reward_rate: u64) -> Bus {
let mut rng = rand::thread_rng();
loop {
Expand Down
11 changes: 10 additions & 1 deletion src/send_and_confirm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,16 @@ impl Miner {
std::thread::sleep(Duration::from_millis(
GATEWAY_DELAY,
));
return Ok(sig);
// MI
// return Ok(sig);
if signature_status.status.is_ok() && signature_status.err.is_none() {
return Ok(sig);
} else {
return Err(ClientError {
request: None,
kind: ClientErrorKind::Custom("Transaction landed with error".into()),
});
}
}
}
} else {
Expand Down

0 comments on commit c5fc847

Please sign in to comment.