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

CLI status command #214

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open

CLI status command #214

wants to merge 3 commits into from

Conversation

thobson88
Copy link
Collaborator

Closes #206.

Adds a new status subcommand that reports the status of the local ION node.

@@ -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.
Copy link
Collaborator

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

Suggested change
// TODO: update the trustchain-api crate.

Comment on lines +412 to +414
#[derive(Debug)]
pub enum BitcoindStatus {
Ok(bool),
Copy link
Collaborator

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:

Suggested change
#[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 {
Copy link
Collaborator

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: {}");
        }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

CLI command to check node status
2 participants