mirror of
https://github.com/stakwork/sphinx-key.git
synced 2025-12-23 02:04:28 +01:00
try connect without async
This commit is contained in:
@@ -6,7 +6,21 @@ use vls_protocol::model::Secret;
|
|||||||
use vls_protocol::{msgs, serde_bolt::WireString};
|
use vls_protocol::{msgs, serde_bolt::WireString};
|
||||||
use vls_proxy::util::{read_allowlist, read_integration_test_seed};
|
use vls_proxy::util::{read_allowlist, read_integration_test_seed};
|
||||||
|
|
||||||
pub async fn connect(tx: mpsc::Sender<ChannelRequest>) {
|
pub fn blocking_connect(tx: mpsc::Sender<ChannelRequest>) {
|
||||||
|
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.blocking_send(request);
|
||||||
|
let res = reply_rx.blocking_recv().expect("couldnt receive");
|
||||||
|
let reply = parser::response_from_bytes(res.reply, 0).expect("could parse init receive");
|
||||||
|
println!("REPLY {:?}", reply);
|
||||||
|
}
|
||||||
|
|
||||||
|
pub async fn _connect(tx: mpsc::Sender<ChannelRequest>) {
|
||||||
let init_msg_2 = crate::init::make_init_msg().expect("could make init msg");
|
let init_msg_2 = crate::init::make_init_msg().expect("could make init msg");
|
||||||
let (reply_tx, reply_rx) = oneshot::channel();
|
let (reply_tx, reply_rx) = oneshot::channel();
|
||||||
// Send a request to the MQTT handler to send to signer
|
// Send a request to the MQTT handler to send to signer
|
||||||
|
|||||||
@@ -60,16 +60,16 @@ fn main() -> anyhow::Result<()> {
|
|||||||
} else {
|
} else {
|
||||||
let (tx, rx) = mpsc::channel(1000);
|
let (tx, rx) = mpsc::channel(1000);
|
||||||
let (status_tx, _status_rx) = mpsc::channel(1000);
|
let (status_tx, _status_rx) = mpsc::channel(1000);
|
||||||
let runtime = start_broker(rx, status_tx, "sphinx-1");
|
let _runtime = start_broker(rx, status_tx, "sphinx-1");
|
||||||
runtime.block_on(async {
|
// runtime.block_on(async {
|
||||||
init::connect(tx.clone()).await;
|
init::blocking_connect(tx.clone());
|
||||||
// listen to reqs from CLN
|
// listen to reqs from CLN
|
||||||
let conn = UnixConnection::new(parent_fd);
|
let conn = UnixConnection::new(parent_fd);
|
||||||
let client = UnixClient::new(conn);
|
let client = UnixClient::new(conn);
|
||||||
// TODO pass status_rx into SignerLoop
|
// TODO pass status_rx into SignerLoop
|
||||||
let mut signer_loop = SignerLoop::new(client, tx);
|
let mut signer_loop = SignerLoop::new(client, tx);
|
||||||
signer_loop.start();
|
signer_loop.start();
|
||||||
})
|
// })
|
||||||
}
|
}
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
|
|||||||
Reference in New Issue
Block a user