try init_hsmd_2 manual seed loading from hsm_secret file

This commit is contained in:
Evan Feenstra
2022-06-09 14:23:51 -07:00
parent e4446f10c6
commit ce00673993
2 changed files with 54 additions and 7 deletions

View File

@@ -1,10 +1,12 @@
mod init;
mod mqtt;
mod run_test;
mod unix_fd;
use crate::mqtt::start_broker;
use crate::unix_fd::SignerLoop;
use clap::{App, AppSettings, Arg};
use crate::mqtt::start_broker;
use sphinx_key_parser as parser;
use std::env;
use tokio::sync::{mpsc, oneshot};
use vls_proxy::client::UnixClient;
@@ -56,12 +58,26 @@ fn main() -> anyhow::Result<()> {
run_test::run_test();
} else {
let (tx, rx) = mpsc::channel(1000);
let _runtime = start_broker(true, rx);
// listen to reqs from CLN
let conn = UnixConnection::new(parent_fd);
let client = UnixClient::new(conn);
let mut signer_loop = SignerLoop::new(client, tx);
signer_loop.start();
let runtime = start_broker(true, rx);
runtime.block_on(async {
let init_msg_2 = crate::init::make_init_msg().expect("could make init msg");
let (reply_tx, reply_rx) = oneshot::channel();
// Send a request to the MQTT handler to send to signer
let request = ChannelRequest {
message: init_msg_2,
reply_tx,
};
let _ = tx.send(request).await;
let res = reply_rx.await.expect("couldnt receive");
let reply =
parser::response_from_bytes(res.reply, 0).expect("could parse init receive");
println!("REPLY {:?}", reply);
// listen to reqs from CLN
let conn = UnixConnection::new(parent_fd);
let client = UnixClient::new(conn);
let mut signer_loop = SignerLoop::new(client, tx);
signer_loop.start();
})
}
Ok(())