tester: read command from cmd.json file

This commit is contained in:
irriden
2023-10-16 22:13:10 +00:00
parent fdb207bf6e
commit b6c8b5a7f1
2 changed files with 2 additions and 10 deletions

View File

@@ -1,3 +1 @@
{ "Nonce"
"type": "GetNonce"
}

View File

@@ -25,13 +25,7 @@ async fn main() -> anyhow::Result<()> {
let seed = hex::decode(seed_string).expect("yo"); let seed = hex::decode(seed_string).expect("yo");
let mut ctrl = controller_from_seed(&Network::Regtest, &seed, nonce); let mut ctrl = controller_from_seed(&Network::Regtest, &seed, nonce);
let mut command = ControlMessage::Nonce; let command = serde_json::from_str::<ControlMessage>(&std::fs::read_to_string("./cmd.json").unwrap()).unwrap();
if let Ok(cmd_content) = std::fs::read_to_string("./tester/cmd.json") {
if let Ok(cmd) = serde_json::from_str::<ControlMessage>(&cmd_content) {
command = cmd;
}
}
println!("COMMAND! {:?}", command); println!("COMMAND! {:?}", command);
let msg = ctrl.build_msg(command)?; let msg = ctrl.build_msg(command)?;