-2

I'm trying to write a code in Rust to sanity check if the bitcoind version of the local machine is upto date with the version that we are currently using in our organisation (say v22.0.0). We have a global variable: org_bitcoind_version = v22.0.0 ;

What could be the code for the required sanity checker function?

2
  • 3
    This is a "good first issue" from revaultd that the OP is tackling in the context of Summer Of Bitcoin (github.com/revault/revaultd/issues/324). @Gourab i guess it goes without saying that contributors to this site are not supposed to write the code you would eventually contribute to an open source project. Mar 14 at 11:50
  • Personal opinion but writing some code and then getting stuck on why it doesn't do what you want it to is fine to ask about on StackExchange (can't guarantee an answer of course). But definitely agree with Antoine that just asking people to write it for you is not a reasonable StackExchange question. Mar 14 at 13:05

1 Answer 1

0

You can check bitcoind version using : bitcoind --version

I have not tried this code but you can execute binary with some arguments using any language:

std::process::Command;

fn main() {
    let bitcoind = Command::new("bitcoind")
                      .arg("version")
                      .output().unwrap();
    println!("Version: {}", String::from_utf8_lossy(&bitcoind.stdout));
}

If the version is printed correctly you can compare it with some strings.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.