common: add logging for peer packets, with status_io.

We log the plaintext, not the encrypted ones.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
Rusty Russell
2018-02-05 14:39:28 +10:30
parent e2eb694619
commit de56dc0ffc
3 changed files with 14 additions and 2 deletions

View File

@@ -15,9 +15,12 @@ bool sync_crypto_write(struct crypto_state *cs, int fd, const void *msg TAKES)
bool post_sabotage = false;
int type = fromwire_peektype(msg);
#endif
u8 *enc = cryptomsg_encrypt_msg(NULL, cs, msg);
u8 *enc;
bool ret;
status_io(LOG_IO_OUT, msg);
enc = cryptomsg_encrypt_msg(NULL, cs, msg);
#if DEVELOPER
switch (dev_disconnect(type)) {
case DEV_DISCONNECT_BEFORE:
@@ -71,6 +74,7 @@ u8 *sync_crypto_read(const tal_t *ctx, struct crypto_state *cs, int fd)
if (!dec)
status_trace("Failed body decrypt with rn=%"PRIu64, cs->rn-2);
else
status_trace("Read decrypt %s", tal_hex(trc, dec));
status_io(LOG_IO_IN, dec);
return dec;
}