Skip to content

Commit 0eed1c8

Browse files
committed
sproxy+plugin: Be very verbose about the HSM requests and responses
1 parent 64785f8 commit 0eed1c8

File tree

2 files changed

+12
-5
lines changed

2 files changed

+12
-5
lines changed

libs/gl-plugin/src/node/mod.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -369,6 +369,7 @@ impl Node for PluginNodeServer {
369369
req.request.signer_state.len()
370370
);
371371

372+
eprintln!("WIRE: plugin -> signer: {:?}", req);
372373
if let Err(e) = tx.send(Ok(req.request)).await {
373374
warn!("Error streaming request {:?} to hsm_id={}", e, hsm_id);
374375
break;
@@ -393,6 +394,7 @@ impl Node for PluginNodeServer {
393394
log::warn!("The above error was returned instead of a response.");
394395
return Ok(Response::new(pb::Empty::default()));
395396
}
397+
eprintln!("WIRE: signer -> plugin: {:?}", req);
396398

397399
// Create a state from the key-value-version tuples. Need to
398400
// convert here, since `pb` is duplicated in the two different

libs/gl-signerproxy/src/hsmproxy.rs

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -70,12 +70,12 @@ async fn process_requests(
7070
if let Ok(msg) = conn.read().await {
7171
match msg.msgtype() {
7272
9 => {
73-
debug!("Got a message from node: {:?}", &msg.body);
73+
eprintln!("Got a message from node: {:?}", &msg.body);
7474
// This requests a new client fd with a given context,
7575
// handle it locally, and defer the creation of the client
7676
// fd on the server side until we need it.
7777
let ctx = HsmRequestContext::from_client_hsmfd_msg(&msg)?;
78-
debug!("Got a request for a new client fd. Context: {:?}", ctx);
78+
eprintln!("Got a request for a new client fd. Context: {:?}", ctx);
7979

8080
let (local, remote) = UnixStream::pair()?;
8181
let local = NodeConnection {
@@ -103,15 +103,20 @@ async fn process_requests(
103103
signer_state: Vec::new(),
104104
});
105105
let start_time = tokio::time::Instant::now();
106-
debug!("Got a message from node: {:?}", &req);
106+
eprintln!(
107+
"WIRE: lightningd -> hsmd: Got a message from node: {:?}",
108+
&req
109+
);
110+
eprintln!("WIRE: hsmd -> plugin: Forwarding: {:?}", &req);
107111
let res = server.request(req).await?.into_inner();
108112
let msg = Message::from_raw(res.raw);
109113
let delta = start_time.elapsed();
110-
debug!(
111-
"Got respone from hsmd: {:?} after {}ms",
114+
eprintln!(
115+
"WIRE: plugin -> hsmd: Got respone from hsmd: {:?} after {}ms",
112116
&msg,
113117
delta.as_millis()
114118
);
119+
eprintln!("WIRE: hsmd -> lightningd: {:?}", &msg);
115120
conn.write(msg).await?
116121
}
117122
}

0 commit comments

Comments
 (0)