-
Notifications
You must be signed in to change notification settings - Fork 5
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
CLI status command #214
base: main
Are you sure you want to change the base?
CLI status command #214
Conversation
@@ -189,6 +196,10 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> { | |||
let resolver = verifier.resolver(); | |||
let mut context_loader = ContextLoader::default(); | |||
match matches.subcommand() { | |||
Some(("status", _)) => { | |||
// TODO: update the trustchain-api crate. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Remove comment as currently not required beyond use in this CLI
// TODO: update the trustchain-api crate. |
#[derive(Debug)] | ||
pub enum BitcoindStatus { | ||
Ok(bool), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could use an enum instead of bool
:
#[derive(Debug)] | |
pub enum BitcoindStatus { | |
Ok(bool), | |
// TODO: update to enum provided by rust-bitcoin latest version | |
pub enum BitcoinNetwork { | |
Mainnet, | |
Testnet | |
} | |
#[derive(Debug)] | |
pub enum BitcoindStatus { | |
Ok(BitcoinNetwork), |
pub async fn print_status() { | ||
let bitcoind_status = bitcoind_status().await; | ||
let mut is_mainnet = false; | ||
if let BitcoindStatus::Ok(x) = bitcoind_status { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As discussed could also check if the bitcoin network running matches the CLI's ION network with something like:
use trustchain_ion::ion::IONTest as ION;
if (ION::NETWORK == "" && !is_mainnet) || (ION::NETWORK == "test" && is_mainnet) {
println!("Wrong bitcoin network running: {}");
}
Closes #206.
Adds a new
status
subcommand that reports the status of the local ION node.