diff --git a/common/crypto_sync.c b/common/crypto_sync.c index 69e4e9744..686b85338 100644 --- a/common/crypto_sync.c +++ b/common/crypto_sync.c @@ -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; } diff --git a/common/cryptomsg.c b/common/cryptomsg.c index 976e380ba..d82af5887 100644 --- a/common/cryptomsg.c +++ b/common/cryptomsg.c @@ -138,6 +138,8 @@ static struct io_plan *peer_decrypt_body(struct io_conn *conn, if (!decrypted) return io_close(conn); + status_io(LOG_IO_IN, decrypted); + /* BOLT #1: * * A node MUST ignore a received message of unknown type, if that type @@ -349,6 +351,8 @@ struct io_plan *peer_write_message(struct io_conn *conn, assert(!pcs->out); + /* Important: this doesn't take msg! */ + status_io(LOG_IO_OUT, msg); pcs->out = cryptomsg_encrypt_msg(conn, &pcs->cs, msg); pcs->next_out = next; diff --git a/lightningd/test/run-cryptomsg.c b/lightningd/test/run-cryptomsg.c index 6642105fe..833c094d1 100644 --- a/lightningd/test/run-cryptomsg.c +++ b/lightningd/test/run-cryptomsg.c @@ -46,6 +46,10 @@ void status_fmt(enum log_level level, const char *fmt, ...) va_end(ap); } +void status_io(enum log_level dir, const u8 *msg) +{ +} + #if DEVELOPER /* AUTOGENERATED MOCKS START */ /* Generated stub for dev_blackhole_fd */