Browse Source

transition from status_trace() to status_debug

travis-debug
darosior 5 years ago
committed by Rusty Russell
parent
commit
0b0ad4c22d
  1. 74
      channeld/channeld.c
  2. 68
      channeld/full_channel.c
  3. 2
      channeld/full_channel.h
  4. 20
      closingd/closingd.c
  5. 6
      common/crypto_sync.c
  6. 6
      common/cryptomsg.c
  7. 2
      common/dev_disconnect.c
  8. 2
      common/ping.c
  9. 2
      common/read_peer_msg.c
  10. 2
      common/status.c
  11. 3
      common/status.h
  12. 4
      common/subdaemon.c
  13. 34
      connectd/connectd.c
  14. 2
      connectd/handshake.c
  15. 6
      connectd/netaddress.c
  16. 2
      connectd/peer_exchange_initmsg.c
  17. 2
      connectd/test/run-initiator-success.c
  18. 10
      connectd/tor.c
  19. 2
      doc/HACKING.md
  20. 10
      gossipd/gossip_store.c
  21. 36
      gossipd/gossipd.c
  22. 40
      gossipd/routing.c
  23. 8
      gossipd/test/run-find_route.c
  24. 2
      hsmd/hsmd.c
  25. 66
      onchaind/onchaind.c
  26. 4
      onchaind/test/run-grind_feerate.c
  27. 8
      openingd/openingd.c

74
channeld/channeld.c

@ -344,7 +344,7 @@ static void send_announcement_signatures(struct peer *peer)
const u8 *msg, *ca, *req; const u8 *msg, *ca, *req;
struct pubkey mykey; struct pubkey mykey;
status_trace("Exchanging announcement signatures."); status_debug("Exchanging announcement signatures.");
ca = create_channel_announcement(tmpctx, peer); ca = create_channel_announcement(tmpctx, peer);
req = towire_hsm_cannouncement_sig_req(tmpctx, ca); req = towire_hsm_cannouncement_sig_req(tmpctx, ca);
@ -677,7 +677,7 @@ static void handle_peer_feechange(struct peer *peer, const u8 *msg)
&peer->channel_id, &peer->channel_id,
"update_fee from non-funder?"); "update_fee from non-funder?");
status_trace("update_fee %u, range %u-%u", status_debug("update_fee %u, range %u-%u",
feerate, peer->feerate_min, peer->feerate_max); feerate, peer->feerate_min, peer->feerate_max);
/* BOLT #2: /* BOLT #2:
@ -706,7 +706,7 @@ static void handle_peer_feechange(struct peer *peer, const u8 *msg)
"update_fee %u unaffordable", "update_fee %u unaffordable",
feerate); feerate);
status_trace("peer updated fee to %u", feerate); status_debug("peer updated fee to %u", feerate);
} }
static struct changed_htlc *changed_htlc_arr(const tal_t *ctx, static struct changed_htlc *changed_htlc_arr(const tal_t *ctx,
@ -787,14 +787,14 @@ static u8 *master_wait_sync_reply(const tal_t *ctx,
{ {
u8 *reply; u8 *reply;
status_trace("Sending master %u", fromwire_peektype(msg)); status_debug("Sending master %u", fromwire_peektype(msg));
if (!wire_sync_write(MASTER_FD, msg)) if (!wire_sync_write(MASTER_FD, msg))
status_failed(STATUS_FAIL_INTERNAL_ERROR, status_failed(STATUS_FAIL_INTERNAL_ERROR,
"Could not set sync write to master: %s", "Could not set sync write to master: %s",
strerror(errno)); strerror(errno));
status_trace("... , awaiting %u", replytype); status_debug("... , awaiting %u", replytype);
for (;;) { for (;;) {
int type; int type;
@ -806,11 +806,11 @@ static u8 *master_wait_sync_reply(const tal_t *ctx,
strerror(errno)); strerror(errno));
type = fromwire_peektype(reply); type = fromwire_peektype(reply);
if (type == replytype) { if (type == replytype) {
status_trace("Got it!"); status_debug("Got it!");
break; break;
} }
status_trace("Nope, got %u instead", type); status_debug("Nope, got %u instead", type);
msg_enqueue(peer->from_master, take(reply)); msg_enqueue(peer->from_master, take(reply));
} }
@ -824,10 +824,10 @@ static u8 *gossipd_wait_sync_reply(const tal_t *ctx,
/* We can forward gossip packets while waiting for our reply. */ /* We can forward gossip packets while waiting for our reply. */
u8 *reply; u8 *reply;
status_trace("Sending gossipd %u", fromwire_peektype(msg)); status_debug("Sending gossipd %u", fromwire_peektype(msg));
wire_sync_write(peer->pps->gossip_fd, msg); wire_sync_write(peer->pps->gossip_fd, msg);
status_trace("... , awaiting %u", replytype); status_debug("... , awaiting %u", replytype);
for (;;) { for (;;) {
int type; int type;
@ -840,7 +840,7 @@ static u8 *gossipd_wait_sync_reply(const tal_t *ctx,
type = fromwire_peektype(reply); type = fromwire_peektype(reply);
if (type == replytype) { if (type == replytype) {
status_trace("Got it!"); status_debug("Got it!");
break; break;
} }
@ -998,7 +998,7 @@ static secp256k1_ecdsa_signature *calc_commitsigs(const tal_t *ctx,
"Reading sign_remote_commitment_tx reply: %s", "Reading sign_remote_commitment_tx reply: %s",
tal_hex(tmpctx, msg)); tal_hex(tmpctx, msg));
status_trace("Creating commit_sig signature %"PRIu64" %s for tx %s wscript %s key %s", status_debug("Creating commit_sig signature %"PRIu64" %s for tx %s wscript %s key %s",
commit_index, commit_index,
type_to_string(tmpctx, struct bitcoin_signature, type_to_string(tmpctx, struct bitcoin_signature,
commit_sig), commit_sig),
@ -1037,7 +1037,7 @@ static secp256k1_ecdsa_signature *calc_commitsigs(const tal_t *ctx,
tal_hex(tmpctx, msg)); tal_hex(tmpctx, msg));
htlc_sigs[i] = sig.s; htlc_sigs[i] = sig.s;
status_trace("Creating HTLC signature %s for tx %s wscript %s key %s", status_debug("Creating HTLC signature %s for tx %s wscript %s key %s",
type_to_string(tmpctx, struct bitcoin_signature, type_to_string(tmpctx, struct bitcoin_signature,
&sig), &sig),
type_to_string(tmpctx, struct bitcoin_tx, txs[1+i]), type_to_string(tmpctx, struct bitcoin_tx, txs[1+i]),
@ -1096,7 +1096,7 @@ static void send_commit(struct peer *peer)
peer->commit_timer_attempts++; peer->commit_timer_attempts++;
/* Only report this in extreme cases */ /* Only report this in extreme cases */
if (peer->commit_timer_attempts % 100 == 0) if (peer->commit_timer_attempts % 100 == 0)
status_trace("Can't send commit:" status_debug("Can't send commit:"
" waiting for revoke_and_ack with %" " waiting for revoke_and_ack with %"
PRIu64" attempts", PRIu64" attempts",
peer->commit_timer_attempts); peer->commit_timer_attempts);
@ -1112,7 +1112,7 @@ static void send_commit(struct peer *peer)
* - MUST NOT send any `update` message after a `shutdown`. * - MUST NOT send any `update` message after a `shutdown`.
*/ */
if (peer->shutdown_sent[LOCAL] && !num_channel_htlcs(peer->channel)) { if (peer->shutdown_sent[LOCAL] && !num_channel_htlcs(peer->channel)) {
status_trace("Can't send commit: final shutdown phase"); status_debug("Can't send commit: final shutdown phase");
peer->commit_timer = NULL; peer->commit_timer = NULL;
return; return;
@ -1160,7 +1160,7 @@ static void send_commit(struct peer *peer)
*/ */
changed_htlcs = tal_arr(tmpctx, const struct htlc *, 0); changed_htlcs = tal_arr(tmpctx, const struct htlc *, 0);
if (!channel_sending_commit(peer->channel, &changed_htlcs)) { if (!channel_sending_commit(peer->channel, &changed_htlcs)) {
status_trace("Can't send commit: nothing to send"); status_debug("Can't send commit: nothing to send");
/* Covers the case where we've just been told to shutdown. */ /* Covers the case where we've just been told to shutdown. */
maybe_send_shutdown(peer); maybe_send_shutdown(peer);
@ -1172,7 +1172,7 @@ static void send_commit(struct peer *peer)
htlc_sigs = calc_commitsigs(tmpctx, peer, peer->next_index[REMOTE], htlc_sigs = calc_commitsigs(tmpctx, peer, peer->next_index[REMOTE],
&commit_sig); &commit_sig);
status_trace("Telling master we're about to commit..."); status_debug("Telling master we're about to commit...");
/* Tell master to save this next commit to database, then wait. */ /* Tell master to save this next commit to database, then wait. */
msg = sending_commitsig_msg(NULL, peer->next_index[REMOTE], msg = sending_commitsig_msg(NULL, peer->next_index[REMOTE],
channel_feerate(peer->channel, REMOTE), channel_feerate(peer->channel, REMOTE),
@ -1183,7 +1183,7 @@ static void send_commit(struct peer *peer)
master_wait_sync_reply(tmpctx, peer, take(msg), master_wait_sync_reply(tmpctx, peer, take(msg),
WIRE_CHANNEL_SENDING_COMMITSIG_REPLY); WIRE_CHANNEL_SENDING_COMMITSIG_REPLY);
status_trace("Sending commit_sig with %zu htlc sigs", status_debug("Sending commit_sig with %zu htlc sigs",
tal_count(htlc_sigs)); tal_count(htlc_sigs));
peer->next_index[REMOTE]++; peer->next_index[REMOTE]++;
@ -1265,7 +1265,7 @@ static void send_revocation(struct peer *peer)
/* If this queues more changes on the other end, send commit. */ /* If this queues more changes on the other end, send commit. */
if (channel_sending_revoke_and_ack(peer->channel)) { if (channel_sending_revoke_and_ack(peer->channel)) {
status_trace("revoke_and_ack made pending: commit timer"); status_debug("revoke_and_ack made pending: commit timer");
start_commit_timer(peer); start_commit_timer(peer);
} }
@ -1375,7 +1375,7 @@ static void handle_peer_commit_sig(struct peer *peer, const u8 *msg)
* - MUST NOT send a `commitment_signed` message that does not * - MUST NOT send a `commitment_signed` message that does not
* include any updates. * include any updates.
*/ */
status_trace("Oh hi LND! Empty commitment at #%"PRIu64, status_debug("Oh hi LND! Empty commitment at #%"PRIu64,
peer->next_index[LOCAL]); peer->next_index[LOCAL]);
if (peer->last_empty_commitment == peer->next_index[LOCAL] - 1) if (peer->last_empty_commitment == peer->next_index[LOCAL] - 1)
peer_failed(peer->pps, peer_failed(peer->pps,
@ -1386,7 +1386,7 @@ static void handle_peer_commit_sig(struct peer *peer, const u8 *msg)
/* We were supposed to check this was affordable as we go. */ /* We were supposed to check this was affordable as we go. */
if (peer->channel->funder == REMOTE) { if (peer->channel->funder == REMOTE) {
status_trace("Feerates are %u/%u", status_debug("Feerates are %u/%u",
peer->channel->view[LOCAL].feerate_per_kw, peer->channel->view[LOCAL].feerate_per_kw,
peer->channel->view[REMOTE].feerate_per_kw); peer->channel->view[REMOTE].feerate_per_kw);
assert(can_funder_afford_feerate(peer->channel, assert(can_funder_afford_feerate(peer->channel,
@ -1411,7 +1411,7 @@ static void handle_peer_commit_sig(struct peer *peer, const u8 *msg)
&peer->next_local_per_commit, &remote_htlckey)) &peer->next_local_per_commit, &remote_htlckey))
status_failed(STATUS_FAIL_INTERNAL_ERROR, status_failed(STATUS_FAIL_INTERNAL_ERROR,
"Deriving remote_htlckey"); "Deriving remote_htlckey");
status_trace("Derived key %s from basepoint %s, point %s", status_debug("Derived key %s from basepoint %s, point %s",
type_to_string(tmpctx, struct pubkey, &remote_htlckey), type_to_string(tmpctx, struct pubkey, &remote_htlckey),
type_to_string(tmpctx, struct pubkey, type_to_string(tmpctx, struct pubkey,
&peer->channel->basepoints[REMOTE].htlc), &peer->channel->basepoints[REMOTE].htlc),
@ -1480,7 +1480,7 @@ static void handle_peer_commit_sig(struct peer *peer, const u8 *msg)
&remote_htlckey)); &remote_htlckey));
} }
status_trace("Received commit_sig with %zu htlc sigs", status_debug("Received commit_sig with %zu htlc sigs",
tal_count(htlc_sigs)); tal_count(htlc_sigs));
/* Tell master daemon, then wait for ack. */ /* Tell master daemon, then wait for ack. */
@ -1506,7 +1506,7 @@ static u8 *got_revoke_msg(const tal_t *ctx, u64 revoke_num,
struct changed_htlc c; struct changed_htlc c;
const struct htlc *htlc = changed_htlcs[i]; const struct htlc *htlc = changed_htlcs[i];
status_trace("HTLC %"PRIu64"[%s] => %s", status_debug("HTLC %"PRIu64"[%s] => %s",
htlc->id, side_to_str(htlc_owner(htlc)), htlc->id, side_to_str(htlc_owner(htlc)),
htlc_state_name(htlc->state)); htlc_state_name(htlc->state));
@ -1568,9 +1568,9 @@ static void handle_peer_revoke_and_ack(struct peer *peer, const u8 *msg)
/* We start timer even if this returns false: we might have delayed /* We start timer even if this returns false: we might have delayed
* commit because we were waiting for this! */ * commit because we were waiting for this! */
if (channel_rcvd_revoke_and_ack(peer->channel, &changed_htlcs)) if (channel_rcvd_revoke_and_ack(peer->channel, &changed_htlcs))
status_trace("Commits outstanding after recv revoke_and_ack"); status_debug("Commits outstanding after recv revoke_and_ack");
else else
status_trace("No commits outstanding after recv revoke_and_ack"); status_debug("No commits outstanding after recv revoke_and_ack");
/* Tell master about things this locks in, wait for response */ /* Tell master about things this locks in, wait for response */
msg = got_revoke_msg(NULL, peer->revocations_received++, msg = got_revoke_msg(NULL, peer->revocations_received++,
@ -1582,7 +1582,7 @@ static void handle_peer_revoke_and_ack(struct peer *peer, const u8 *msg)
peer->old_remote_per_commit = peer->remote_per_commit; peer->old_remote_per_commit = peer->remote_per_commit;
peer->remote_per_commit = next_per_commit; peer->remote_per_commit = next_per_commit;
status_trace("revoke_and_ack %s: remote_per_commit = %s, old_remote_per_commit = %s", status_debug("revoke_and_ack %s: remote_per_commit = %s, old_remote_per_commit = %s",
side_to_str(peer->channel->funder), side_to_str(peer->channel->funder),
type_to_string(tmpctx, struct pubkey, type_to_string(tmpctx, struct pubkey,
&peer->remote_per_commit), &peer->remote_per_commit),
@ -1948,7 +1948,7 @@ static void resend_commitment(struct peer *peer, const struct changed_htlc *last
secp256k1_ecdsa_signature *htlc_sigs; secp256k1_ecdsa_signature *htlc_sigs;
u8 *msg; u8 *msg;
status_trace("Retransmitting commitment, feerate LOCAL=%u REMOTE=%u", status_debug("Retransmitting commitment, feerate LOCAL=%u REMOTE=%u",
channel_feerate(peer->channel, LOCAL), channel_feerate(peer->channel, LOCAL),
channel_feerate(peer->channel, REMOTE)); channel_feerate(peer->channel, REMOTE));
@ -2106,7 +2106,7 @@ static void check_current_dataloss_fields(struct peer *peer,
* - MUST set `your_last_per_commitment_secret` to all zeroes * - MUST set `your_last_per_commitment_secret` to all zeroes
*/ */
status_trace("next_revocation_number = %"PRIu64, status_debug("next_revocation_number = %"PRIu64,
next_revocation_number); next_revocation_number);
if (next_revocation_number == 0) if (next_revocation_number == 0)
memset(&old_commit_secret, 0, sizeof(old_commit_secret)); memset(&old_commit_secret, 0, sizeof(old_commit_secret));
@ -2130,7 +2130,7 @@ static void check_current_dataloss_fields(struct peer *peer,
type_to_string(tmpctx, struct secret, type_to_string(tmpctx, struct secret,
&old_commit_secret)); &old_commit_secret));
status_trace("Reestablish, comparing commitments. Remote's next local commitment number" status_debug("Reestablish, comparing commitments. Remote's next local commitment number"
" is %"PRIu64". Our next remote is %"PRIu64" with %"PRIu64 " is %"PRIu64". Our next remote is %"PRIu64" with %"PRIu64
" revocations received", " revocations received",
next_commitment_number, next_commitment_number,
@ -2173,7 +2173,7 @@ static void check_current_dataloss_fields(struct peer *peer,
} }
} }
status_trace("option_data_loss_protect: fields are correct"); status_debug("option_data_loss_protect: fields are correct");
} }
/* Older LND sometimes sends funding_locked before reestablish! */ /* Older LND sometimes sends funding_locked before reestablish! */
@ -2187,7 +2187,7 @@ static bool capture_premature_msg(const u8 ***shit_lnd_says, const u8 *msg)
if (tal_count(*shit_lnd_says) > 10) if (tal_count(*shit_lnd_says) > 10)
return false; return false;
status_trace("Stashing early %s msg!", status_debug("Stashing early %s msg!",
wire_type_name(fromwire_peektype(msg))); wire_type_name(fromwire_peektype(msg)));
tal_arr_expand(shit_lnd_says, tal_steal(*shit_lnd_says, msg)); tal_arr_expand(shit_lnd_says, tal_steal(*shit_lnd_says, msg));
@ -2298,7 +2298,7 @@ static void peer_reconnect(struct peer *peer,
} }
} }
status_trace("Got reestablish commit=%"PRIu64" revoke=%"PRIu64, status_debug("Got reestablish commit=%"PRIu64" revoke=%"PRIu64,
next_commitment_number, next_commitment_number,
next_revocation_number); next_revocation_number);
@ -2513,7 +2513,7 @@ static void handle_funding_depth(struct peer *peer, const u8 *msg)
if (!peer->funding_locked[LOCAL]) { if (!peer->funding_locked[LOCAL]) {
status_trace("funding_locked: sending commit index %"PRIu64": %s", status_debug("funding_locked: sending commit index %"PRIu64": %s",
peer->next_index[LOCAL], peer->next_index[LOCAL],
type_to_string(tmpctx, struct pubkey, type_to_string(tmpctx, struct pubkey,
&peer->next_local_per_commit)); &peer->next_local_per_commit));
@ -2560,7 +2560,7 @@ static void handle_offer_htlc(struct peer *peer, const u8 *inmsg)
e = channel_add_htlc(peer->channel, LOCAL, peer->htlc_id, e = channel_add_htlc(peer->channel, LOCAL, peer->htlc_id,
amount, cltv_expiry, &payment_hash, amount, cltv_expiry, &payment_hash,
onion_routing_packet, NULL, &htlc_fee); onion_routing_packet, NULL, &htlc_fee);
status_trace("Adding HTLC %"PRIu64" amount=%s cltv=%u gave %s", status_debug("Adding HTLC %"PRIu64" amount=%s cltv=%u gave %s",
peer->htlc_id, peer->htlc_id,
type_to_string(tmpctx, struct amount_msat, &amount), type_to_string(tmpctx, struct amount_msat, &amount),
cltv_expiry, cltv_expiry,
@ -2744,7 +2744,7 @@ static void handle_dev_reenable_commit(struct peer *peer)
{ {
dev_suppress_commit = false; dev_suppress_commit = false;
start_commit_timer(peer); start_commit_timer(peer);
status_trace("dev_reenable_commit"); status_debug("dev_reenable_commit");
wire_sync_write(MASTER_FD, wire_sync_write(MASTER_FD,
take(towire_channel_dev_reenable_commit_reply(NULL))); take(towire_channel_dev_reenable_commit_reply(NULL)));
} }
@ -2930,7 +2930,7 @@ static void init_channel(struct peer *peer)
/* stdin == requests, 3 == peer, 4 = gossip, 5 = gossip_store, 6 = HSM */ /* stdin == requests, 3 == peer, 4 = gossip, 5 = gossip_store, 6 = HSM */
per_peer_state_set_fds(peer->pps, 3, 4, 5); per_peer_state_set_fds(peer->pps, 3, 4, 5);
status_trace("init %s: remote_per_commit = %s, old_remote_per_commit = %s" status_debug("init %s: remote_per_commit = %s, old_remote_per_commit = %s"
" next_idx_local = %"PRIu64 " next_idx_local = %"PRIu64
" next_idx_remote = %"PRIu64 " next_idx_remote = %"PRIu64
" revocations_received = %"PRIu64 " revocations_received = %"PRIu64
@ -3105,7 +3105,7 @@ int main(int argc, char *argv[])
/* For simplicity, we process one event at a time. */ /* For simplicity, we process one event at a time. */
msg = msg_dequeue(peer->from_master); msg = msg_dequeue(peer->from_master);
if (msg) { if (msg) {
status_trace("Now dealing with deferred %s", status_debug("Now dealing with deferred %s",
channel_wire_type_name( channel_wire_type_name(
fromwire_peektype(msg))); fromwire_peektype(msg)));
req_in(peer, msg); req_in(peer, msg);

68
channeld/full_channel.c

@ -118,7 +118,7 @@ static void dump_htlc(const struct htlc *htlc, const char *prefix)
else else
remote_state = htlc->state - 10; remote_state = htlc->state - 10;
status_trace("%s: HTLC %s %"PRIu64" = %s/%s %s", status_debug("%s: HTLC %s %"PRIu64" = %s/%s %s",
prefix, prefix,
htlc_owner(htlc) == LOCAL ? "LOCAL" : "REMOTE", htlc_owner(htlc) == LOCAL ? "LOCAL" : "REMOTE",
htlc->id, htlc->id,
@ -322,13 +322,13 @@ static bool get_room_above_reserve(const struct channel *channel,
/* Can happen if amount completely exceeds capacity */ /* Can happen if amount completely exceeds capacity */
if (!ok) { if (!ok) {
status_trace("Failed to add %zu remove %zu htlcs", status_debug("Failed to add %zu remove %zu htlcs",
tal_count(adding), tal_count(removing)); tal_count(adding), tal_count(removing));
return false; return false;
} }
if (!amount_msat_sub_sat(balance, *balance, reserve)) { if (!amount_msat_sub_sat(balance, *balance, reserve)) {
status_trace("%s cannot afford htlc: would make balance %s" status_debug("%s cannot afford htlc: would make balance %s"
" below reserve %s", " below reserve %s",
side_to_str(side), side_to_str(side),
type_to_string(tmpctx, struct amount_msat, type_to_string(tmpctx, struct amount_msat,
@ -532,7 +532,7 @@ static enum channel_add_err add_htlc(struct channel *channel,
if (channel->funder == sender) { if (channel->funder == sender) {
if (amount_msat_less_sat(balance, fee)) { if (amount_msat_less_sat(balance, fee)) {
status_trace("Cannot afford fee %s with %s above reserve", status_debug("Cannot afford fee %s with %s above reserve",
type_to_string(tmpctx, struct amount_sat, type_to_string(tmpctx, struct amount_sat,
&fee), &fee),
type_to_string(tmpctx, struct amount_msat, type_to_string(tmpctx, struct amount_msat,
@ -561,7 +561,7 @@ static enum channel_add_err add_htlc(struct channel *channel,
if (htlc_fee && amount_sat_greater(fee, *htlc_fee)) if (htlc_fee && amount_sat_greater(fee, *htlc_fee))
*htlc_fee = fee; *htlc_fee = fee;
if (amount_msat_less_sat(balance, fee)) { if (amount_msat_less_sat(balance, fee)) {
status_trace("Funder could not afford own fee %s with %s above reserve", status_debug("Funder could not afford own fee %s with %s above reserve",
type_to_string(tmpctx, type_to_string(tmpctx,
struct amount_sat, struct amount_sat,
&fee), &fee),
@ -579,7 +579,7 @@ static enum channel_add_err add_htlc(struct channel *channel,
if (htlc_fee && amount_sat_greater(fee, *htlc_fee)) if (htlc_fee && amount_sat_greater(fee, *htlc_fee))
*htlc_fee = fee; *htlc_fee = fee;
if (amount_msat_less_sat(balance, fee)) { if (amount_msat_less_sat(balance, fee)) {
status_trace("Funder could not afford peer's fee %s with %s above reserve", status_debug("Funder could not afford peer's fee %s with %s above reserve",
type_to_string(tmpctx, type_to_string(tmpctx,
struct amount_sat, struct amount_sat,
&fee), &fee),
@ -753,7 +753,7 @@ static void htlc_incstate(struct channel *channel,
int preflags, postflags; int preflags, postflags;
const int committed_f = HTLC_FLAG(sidechanged, HTLC_F_COMMITTED); const int committed_f = HTLC_FLAG(sidechanged, HTLC_F_COMMITTED);
status_trace("htlc %"PRIu64": %s->%s", htlc->id, status_debug("htlc %"PRIu64": %s->%s", htlc->id,
htlc_state_name(htlc->state), htlc_state_name(htlc->state),
htlc_state_name(htlc->state+1)); htlc_state_name(htlc->state+1));
@ -767,7 +767,7 @@ static void htlc_incstate(struct channel *channel,
/* If we've added or removed, adjust balances. */ /* If we've added or removed, adjust balances. */
if (!(preflags & committed_f) && (postflags & committed_f)) { if (!(preflags & committed_f) && (postflags & committed_f)) {
status_trace("htlc added %s: local %s remote %s", status_debug("htlc added %s: local %s remote %s",
side_to_str(sidechanged), side_to_str(sidechanged),
type_to_string(tmpctx, struct amount_msat, type_to_string(tmpctx, struct amount_msat,
&channel->view[sidechanged].owed[LOCAL]), &channel->view[sidechanged].owed[LOCAL]),
@ -789,13 +789,13 @@ static void htlc_incstate(struct channel *channel,
htlc->id, htlc->id,
type_to_string(tmpctx, struct amount_msat, type_to_string(tmpctx, struct amount_msat,
&htlc->amount)); &htlc->amount));
status_trace("-> local %s remote %s", status_debug("-> local %s remote %s",
type_to_string(tmpctx, struct amount_msat, type_to_string(tmpctx, struct amount_msat,
&channel->view[sidechanged].owed[LOCAL]), &channel->view[sidechanged].owed[LOCAL]),
type_to_string(tmpctx, struct amount_msat, type_to_string(tmpctx, struct amount_msat,
&channel->view[sidechanged].owed[REMOTE])); &channel->view[sidechanged].owed[REMOTE]));
} else if ((preflags & committed_f) && !(postflags & committed_f)) { } else if ((preflags & committed_f) && !(postflags & committed_f)) {
status_trace("htlc added %s: local %s remote %s", status_debug("htlc added %s: local %s remote %s",
side_to_str(sidechanged), side_to_str(sidechanged),
type_to_string(tmpctx, struct amount_msat, type_to_string(tmpctx, struct amount_msat,
&channel->view[sidechanged].owed[LOCAL]), &channel->view[sidechanged].owed[LOCAL]),
@ -817,7 +817,7 @@ static void htlc_incstate(struct channel *channel,
htlc->id, htlc->id,
type_to_string(tmpctx, struct amount_msat, type_to_string(tmpctx, struct amount_msat,
&htlc->amount)); &htlc->amount));
status_trace("-> local %s remote %s", status_debug("-> local %s remote %s",
type_to_string(tmpctx, struct amount_msat, type_to_string(tmpctx, struct amount_msat,
&channel->view[sidechanged].owed[LOCAL]), &channel->view[sidechanged].owed[LOCAL]),
type_to_string(tmpctx, struct amount_msat, type_to_string(tmpctx, struct amount_msat,
@ -923,7 +923,7 @@ bool can_funder_afford_feerate(const struct channel *channel, u32 feerate_per_kw
type_to_string(tmpctx, struct amount_sat, type_to_string(tmpctx, struct amount_sat,
&channel->config[!channel->funder].channel_reserve)); &channel->config[!channel->funder].channel_reserve));
status_trace("We need %s at feerate %u for %zu untrimmed htlcs: we have %s/%s", status_debug("We need %s at feerate %u for %zu untrimmed htlcs: we have %s/%s",
type_to_string(tmpctx, struct amount_sat, &needed), type_to_string(tmpctx, struct amount_sat, &needed),
feerate_per_kw, untrimmed, feerate_per_kw, untrimmed,
type_to_string(tmpctx, struct amount_msat, type_to_string(tmpctx, struct amount_msat,
@ -939,7 +939,7 @@ bool channel_update_feerate(struct channel *channel, u32 feerate_per_kw)
if (!can_funder_afford_feerate(channel, feerate_per_kw)) if (!can_funder_afford_feerate(channel, feerate_per_kw))
return false; return false;
status_trace("Setting %s feerate to %u", status_debug("Setting %s feerate to %u",
side_to_str(!channel->funder), feerate_per_kw); side_to_str(!channel->funder), feerate_per_kw);
channel->view[!channel->funder].feerate_per_kw = feerate_per_kw; channel->view[!channel->funder].feerate_per_kw = feerate_per_kw;
@ -959,7 +959,7 @@ bool channel_sending_commit(struct channel *channel,
SENT_REMOVE_REVOCATION, SENT_REMOVE_REVOCATION,
SENT_ADD_REVOCATION, SENT_ADD_REVOCATION,
SENT_REMOVE_HTLC }; SENT_REMOVE_HTLC };
status_trace("Trying commit"); status_debug("Trying commit");
if (!channel->changes_pending[REMOTE]) { if (!channel->changes_pending[REMOTE]) {
assert(change_htlcs(channel, REMOTE, states, ARRAY_SIZE(states), assert(change_htlcs(channel, REMOTE, states, ARRAY_SIZE(states),
@ -983,7 +983,7 @@ bool channel_rcvd_revoke_and_ack(struct channel *channel,
SENT_ADD_ACK_COMMIT, SENT_ADD_ACK_COMMIT,
SENT_REMOVE_COMMIT }; SENT_REMOVE_COMMIT };
status_trace("Received revoke_and_ack"); status_debug("Received revoke_and_ack");
change = change_htlcs(channel, LOCAL, states, ARRAY_SIZE(states), change = change_htlcs(channel, LOCAL, states, ARRAY_SIZE(states),
htlcs, "rcvd_revoke_and_ack"); htlcs, "rcvd_revoke_and_ack");
@ -995,7 +995,7 @@ bool channel_rcvd_revoke_and_ack(struct channel *channel,
if (channel->funder == LOCAL && if (channel->funder == LOCAL &&
(channel->view[LOCAL].feerate_per_kw (channel->view[LOCAL].feerate_per_kw
!= channel->view[REMOTE].feerate_per_kw)) { != channel->view[REMOTE].feerate_per_kw)) {
status_trace("Applying feerate %u to LOCAL", status_debug("Applying feerate %u to LOCAL",
channel->view[REMOTE].feerate_per_kw); channel->view[REMOTE].feerate_per_kw);
channel->view[LOCAL].feerate_per_kw channel->view[LOCAL].feerate_per_kw
= channel->view[REMOTE].feerate_per_kw; = channel->view[REMOTE].feerate_per_kw;
@ -1013,7 +1013,7 @@ bool channel_rcvd_commit(struct channel *channel, const struct htlc ***htlcs)
RCVD_ADD_HTLC, RCVD_ADD_HTLC,
RCVD_REMOVE_REVOCATION }; RCVD_REMOVE_REVOCATION };
status_trace("Received commit"); status_debug("Received commit");
if (!channel->changes_pending[LOCAL]) { if (!channel->changes_pending[LOCAL]) {
assert(change_htlcs(channel, LOCAL, states, ARRAY_SIZE(states), assert(change_htlcs(channel, LOCAL, states, ARRAY_SIZE(states),
htlcs, "testing rcvd_commit") == 0); htlcs, "testing rcvd_commit") == 0);
@ -1034,7 +1034,7 @@ bool channel_sending_revoke_and_ack(struct channel *channel)
RCVD_REMOVE_COMMIT, RCVD_REMOVE_COMMIT,
RCVD_ADD_COMMIT, RCVD_ADD_COMMIT,
RCVD_REMOVE_ACK_COMMIT }; RCVD_REMOVE_ACK_COMMIT };
status_trace("Sending revoke_and_ack"); status_debug("Sending revoke_and_ack");
change = change_htlcs(channel, REMOTE, states, ARRAY_SIZE(states), NULL, change = change_htlcs(channel, REMOTE, states, ARRAY_SIZE(states), NULL,
"sending_revoke_and_ack"); "sending_revoke_and_ack");
@ -1046,7 +1046,7 @@ bool channel_sending_revoke_and_ack(struct channel *channel)
if (channel->funder == REMOTE if (channel->funder == REMOTE
&& (channel->view[LOCAL].feerate_per_kw && (channel->view[LOCAL].feerate_per_kw
!= channel->view[REMOTE].feerate_per_kw)) { != channel->view[REMOTE].feerate_per_kw)) {
status_trace("Applying feerate %u to REMOTE", status_debug("Applying feerate %u to REMOTE",
channel->view[LOCAL].feerate_per_kw); channel->view[LOCAL].feerate_per_kw);
channel->view[REMOTE].feerate_per_kw channel->view[REMOTE].feerate_per_kw
= channel->view[LOCAL].feerate_per_kw; = channel->view[LOCAL].feerate_per_kw;
@ -1151,19 +1151,19 @@ bool channel_force_htlcs(struct channel *channel,
struct htlc_map_iter it; struct htlc_map_iter it;
if (tal_count(hstates) != tal_count(htlcs)) { if (tal_count(hstates) != tal_count(htlcs)) {
status_trace("#hstates %zu != #htlcs %zu", status_debug("#hstates %zu != #htlcs %zu",
tal_count(hstates), tal_count(htlcs)); tal_count(hstates), tal_count(htlcs));
return false; return false;
} }
if (tal_count(fulfilled) != tal_count(fulfilled_sides)) { if (tal_count(fulfilled) != tal_count(fulfilled_sides)) {
status_trace("#fulfilled sides %zu != #fulfilled %zu", status_debug("#fulfilled sides %zu != #fulfilled %zu",
tal_count(fulfilled_sides), tal_count(fulfilled)); tal_count(fulfilled_sides), tal_count(fulfilled));
return false; return false;
} }
if (tal_count(failed) != tal_count(failed_sides)) { if (tal_count(failed) != tal_count(failed_sides)) {
status_trace("#failed sides %zu != #failed %zu", status_debug("#failed sides %zu != #failed %zu",
tal_count(failed_sides), tal_count(failed)); tal_count(failed_sides), tal_count(failed));
return false; return false;
} }
@ -1171,7 +1171,7 @@ bool channel_force_htlcs(struct channel *channel,
enum channel_add_err e; enum channel_add_err e;
struct htlc *htlc; struct htlc *htlc;
status_trace("Restoring HTLC %zu/%zu:" status_debug("Restoring HTLC %zu/%zu:"
" id=%"PRIu64" amount=%s cltv=%u" " id=%"PRIu64" amount=%s cltv=%u"
" payment_hash=%s", " payment_hash=%s",
i, tal_count(htlcs), i, tal_count(htlcs),
@ -1188,7 +1188,7 @@ bool channel_force_htlcs(struct channel *channel,
&htlcs[i].payment_hash, &htlcs[i].payment_hash,
htlcs[i].onion_routing_packet, &htlc, false, NULL); htlcs[i].onion_routing_packet, &htlc, false, NULL);
if (e != CHANNEL_ERR_ADD_OK) { if (e != CHANNEL_ERR_ADD_OK) {
status_trace("%s HTLC %"PRIu64" failed error %u", status_debug("%s HTLC %"PRIu64" failed error %u",
htlc_state_owner(hstates[i]) == LOCAL htlc_state_owner(hstates[i]) == LOCAL
? "out" : "in", htlcs[i].id, e); ? "out" : "in", htlcs[i].id, e);
return false; return false;
@ -1200,31 +1200,31 @@ bool channel_force_htlcs(struct channel *channel,
fulfilled_sides[i], fulfilled_sides[i],
fulfilled[i].id); fulfilled[i].id);
if (!htlc) { if (!htlc) {
status_trace("Fulfill %s HTLC %"PRIu64" not found", status_debug("Fulfill %s HTLC %"PRIu64" not found",
fulfilled_sides[i] == LOCAL ? "out" : "in", fulfilled_sides[i] == LOCAL ? "out" : "in",
fulfilled[i].id); fulfilled[i].id);
return false; return false;
} }
if (htlc->r) { if (htlc->r) {
status_trace("Fulfill %s HTLC %"PRIu64" already fulfilled", status_debug("Fulfill %s HTLC %"PRIu64" already fulfilled",
fulfilled_sides[i] == LOCAL ? "out" : "in", fulfilled_sides[i] == LOCAL ? "out" : "in",
fulfilled[i].id); fulfilled[i].id);
return false; return false;
} }
if (htlc->fail) { if (htlc->fail) {
status_trace("Fulfill %s HTLC %"PRIu64" already failed", status_debug("Fulfill %s HTLC %"PRIu64" already failed",
fulfilled_sides[i] == LOCAL ? "out" : "in", fulfilled_sides[i] == LOCAL ? "out" : "in",
fulfilled[i].id); fulfilled[i].id);
return false; return false;
} }
if (htlc->failcode) { if (htlc->failcode) {
status_trace("Fulfill %s HTLC %"PRIu64" already fail %u", status_debug("Fulfill %s HTLC %"PRIu64" already fail %u",
fulfilled_sides[i] == LOCAL ? "out" : "in", fulfilled_sides[i] == LOCAL ? "out" : "in",
fulfilled[i].id, htlc->failcode); fulfilled[i].id, htlc->failcode);
return false; return false;
} }
if (!htlc_has(htlc, HTLC_REMOVING)) { if (!htlc_has(htlc, HTLC_REMOVING)) {
status_trace("Fulfill %s HTLC %"PRIu64" state %s", status_debug("Fulfill %s HTLC %"PRIu64" state %s",
fulfilled_sides[i] == LOCAL ? "out" : "in", fulfilled_sides[i] == LOCAL ? "out" : "in",
fulfilled[i].id, fulfilled[i].id,
htlc_state_name(htlc->state)); htlc_state_name(htlc->state));
@ -1239,31 +1239,31 @@ bool channel_force_htlcs(struct channel *channel,
htlc = channel_get_htlc(channel, failed_sides[i], htlc = channel_get_htlc(channel, failed_sides[i],
failed[i]->id); failed[i]->id);
if (!htlc) { if (!htlc) {
status_trace("Fail %s HTLC %"PRIu64" not found", status_debug("Fail %s HTLC %"PRIu64" not found",
failed_sides[i] == LOCAL ? "out" : "in", failed_sides[i] == LOCAL ? "out" : "in",
failed[i]->id); failed[i]->id);
return false; return false;
} }
if (htlc->r) { if (htlc->r) {
status_trace("Fail %s HTLC %"PRIu64" already fulfilled", status_debug("Fail %s HTLC %"PRIu64" already fulfilled",
failed_sides[i] == LOCAL ? "out" : "in", failed_sides[i] == LOCAL ? "out" : "in",
failed[i]->id); failed[i]->id);
return false; return false;
} }
if (htlc->fail) { if (htlc->fail) {
status_trace("Fail %s HTLC %"PRIu64" already failed", status_debug("Fail %s HTLC %"PRIu64" already failed",
failed_sides[i] == LOCAL ? "out" : "in", failed_sides[i] == LOCAL ? "out" : "in",
failed[i]->id); failed[i]->id);
return false; return false;
} }
if (htlc->failcode) { if (htlc->failcode) {
status_trace("Fail %s HTLC %"PRIu64" already fail %u", status_debug("Fail %s HTLC %"PRIu64" already fail %u",
failed_sides[i] == LOCAL ? "out" : "in", failed_sides[i] == LOCAL ? "out" : "in",
failed[i]->id, htlc->failcode); failed[i]->id, htlc->failcode);
return false; return false;
} }
if (!htlc_has(htlc, HTLC_REMOVING)) { if (!htlc_has(htlc, HTLC_REMOVING)) {
status_trace("Fail %s HTLC %"PRIu64" state %s", status_debug("Fail %s HTLC %"PRIu64" state %s",
failed_sides[i] == LOCAL ? "out" : "in", failed_sides[i] == LOCAL ? "out" : "in",
fulfilled[i].id, fulfilled[i].id,
htlc_state_name(htlc->state)); htlc_state_name(htlc->state));

2
channeld/full_channel.h

@ -254,7 +254,7 @@ bool channel_force_htlcs(struct channel *channel,
* @channel: the channel * @channel: the channel
* @prefix: the prefix to prepend to each line. * @prefix: the prefix to prepend to each line.
* *
* Uses status_trace() on every HTLC. * Uses status_debug() on every HTLC.
*/ */
void dump_htlcs(const struct channel *channel, const char *prefix); void dump_htlcs(const struct channel *channel, const char *prefix);

20
closingd/closingd.c

@ -57,7 +57,7 @@ static struct bitcoin_tx *close_tx(const tal_t *ctx,
type_to_string(tmpctx, struct amount_sat, type_to_string(tmpctx, struct amount_sat,
&out[REMOTE])); &out[REMOTE]));
status_trace("Making close tx at = %s/%s fee %s", status_debug("Making close tx at = %s/%s fee %s",
type_to_string(tmpctx, struct amount_sat, &out[LOCAL]), type_to_string(tmpctx, struct amount_sat, &out[LOCAL]),
type_to_string(tmpctx, struct amount_sat, &out[REMOTE]), type_to_string(tmpctx, struct amount_sat, &out[REMOTE]),
type_to_string(tmpctx, struct amount_sat, &fee)); type_to_string(tmpctx, struct amount_sat, &fee));
@ -202,7 +202,7 @@ static void do_reconnect(struct per_peer_state *pps,
wire_type_name(fromwire_peektype(channel_reestablish)), wire_type_name(fromwire_peektype(channel_reestablish)),
tal_hex(tmpctx, channel_reestablish)); tal_hex(tmpctx, channel_reestablish));
} }
status_trace("Got reestablish commit=%"PRIu64" revoke=%"PRIu64, status_debug("Got reestablish commit=%"PRIu64" revoke=%"PRIu64,
next_local_commitment_number, next_local_commitment_number,
next_remote_revocation_number); next_remote_revocation_number);
@ -283,7 +283,7 @@ static void send_offer(struct per_peer_state *pps,
"Bad hsm_sign_mutual_close_tx reply %s", "Bad hsm_sign_mutual_close_tx reply %s",
tal_hex(tmpctx, msg)); tal_hex(tmpctx, msg));
status_trace("sending fee offer %s", status_debug("sending fee offer %s",
type_to_string(tmpctx, struct amount_sat, &fee_to_offer)); type_to_string(tmpctx, struct amount_sat, &fee_to_offer));
assert(our_sig.sighash_type == SIGHASH_ALL); assert(our_sig.sighash_type == SIGHASH_ALL);
@ -420,12 +420,12 @@ receive_offer(struct per_peer_state *pps,
tx = trimmed; tx = trimmed;
} }
status_trace("Received fee offer %s", status_debug("Received fee offer %s",
type_to_string(tmpctx, struct amount_sat, &received_fee)); type_to_string(tmpctx, struct amount_sat, &received_fee));
/* Master sorts out what is best offer, we just tell it any above min */ /* Master sorts out what is best offer, we just tell it any above min */
if (amount_sat_greater_eq(received_fee, min_fee_to_accept)) { if (amount_sat_greater_eq(received_fee, min_fee_to_accept)) {
status_trace("...offer is reasonable"); status_debug("...offer is reasonable");
tell_master_their_offer(&their_sig, tx, closing_txid); tell_master_their_offer(&their_sig, tx, closing_txid);
} }
@ -456,7 +456,7 @@ static void init_feerange(struct feerange *feerange,
else else
feerange->higher_side = REMOTE; feerange->higher_side = REMOTE;
status_trace("Feerange init %s-%s, %s higher", status_debug("Feerange init %s-%s, %s higher",
type_to_string(tmpctx, struct amount_sat, &feerange->min), type_to_string(tmpctx, struct amount_sat, &feerange->min),
type_to_string(tmpctx, struct amount_sat, &feerange->max), type_to_string(tmpctx, struct amount_sat, &feerange->max),
feerange->higher_side == LOCAL ? "local" : "remote"); feerange->higher_side == LOCAL ? "local" : "remote");
@ -477,7 +477,7 @@ static void adjust_feerange(struct feerange *feerange,
else else
ok = amount_sat_add(&feerange->min, offer, AMOUNT_SAT(1)); ok = amount_sat_add(&feerange->min, offer, AMOUNT_SAT(1));
status_trace("Feerange %s update %s: now %s-%s", status_debug("Feerange %s update %s: now %s-%s",
side == LOCAL ? "local" : "remote", side == LOCAL ? "local" : "remote",
type_to_string(tmpctx, struct amount_sat, &offer), type_to_string(tmpctx, struct amount_sat, &offer),
type_to_string(tmpctx, struct amount_sat, &feerange->min), type_to_string(tmpctx, struct amount_sat, &feerange->min),
@ -612,12 +612,12 @@ int main(int argc, char *argv[])
per_peer_state_set_fds(pps, 3, 4, 5); per_peer_state_set_fds(pps, 3, 4, 5);
chainparams = chainparams_by_chainhash(&chain_hash); chainparams = chainparams_by_chainhash(&chain_hash);
status_trace("out = %s/%s", status_debug("out = %s/%s",
type_to_string(tmpctx, struct amount_sat, &out[LOCAL]), type_to_string(tmpctx, struct amount_sat, &out[LOCAL]),
type_to_string(tmpctx, struct amount_sat, &out[REMOTE])); type_to_string(tmpctx, struct amount_sat, &out[REMOTE]));
status_trace("dustlimit = %s", status_debug("dustlimit = %s",
type_to_string(tmpctx, struct amount_sat, &our_dust_limit)); type_to_string(tmpctx, struct amount_sat, &our_dust_limit));
status_trace("fee = %s", status_debug("fee = %s",
type_to_string(tmpctx, struct amount_sat, &offer[LOCAL])); type_to_string(tmpctx, struct amount_sat, &offer[LOCAL]));
derive_channel_id(&channel_id, &funding_txid, funding_txout); derive_channel_id(&channel_id, &funding_txid, funding_txout);

6
common/crypto_sync.c

@ -103,19 +103,19 @@ u8 *sync_crypto_read(const tal_t *ctx, struct per_peer_state *pps)
u16 len; u16 len;
if (!read_all(pps->peer_fd, hdr, sizeof(hdr))) { if (!read_all(pps->peer_fd, hdr, sizeof(hdr))) {
status_trace("Failed reading header: %s", strerror(errno)); status_debug("Failed reading header: %s", strerror(errno));
peer_failed_connection_lost(); peer_failed_connection_lost();
} }
if (!cryptomsg_decrypt_header(&pps->cs, hdr, &len)) { if (!cryptomsg_decrypt_header(&pps->cs, hdr, &len)) {
status_trace("Failed hdr decrypt with rn=%"PRIu64, status_debug("Failed hdr decrypt with rn=%"PRIu64,
pps->cs.rn-1); pps->cs.rn-1);
peer_failed_connection_lost(); peer_failed_connection_lost();
} }
enc = tal_arr(ctx, u8, len + 16); enc = tal_arr(ctx, u8, len + 16);
if (!read_all(pps->peer_fd, enc, tal_count(enc))) { if (!read_all(pps->peer_fd, enc, tal_count(enc))) {
status_trace("Failed reading body: %s", strerror(errno)); status_debug("Failed reading body: %s", strerror(errno));
peer_failed_connection_lost(); peer_failed_connection_lost();
} }

6
common/cryptomsg.c

@ -63,7 +63,7 @@ static void maybe_rotate_key(u64 *n, struct secret *k, struct secret *ck)
*/ */
hkdf_two_keys(&new_ck, &new_k, ck, k); hkdf_two_keys(&new_ck, &new_k, ck, k);
#ifdef SUPERVERBOSE #ifdef SUPERVERBOSE
status_trace("# 0x%s, 0x%s = HKDF(0x%s, 0x%s)", status_debug("# 0x%s, 0x%s = HKDF(0x%s, 0x%s)",
tal_hexstr(trc, &new_ck, sizeof(new_ck)), tal_hexstr(trc, &new_ck, sizeof(new_ck)),
tal_hexstr(trc, &new_k, sizeof(new_k)), tal_hexstr(trc, &new_k, sizeof(new_k)),
tal_hexstr(trc, ck, sizeof(*ck)), tal_hexstr(trc, ck, sizeof(*ck)),
@ -204,7 +204,7 @@ u8 *cryptomsg_encrypt_msg(const tal_t *ctx,
assert(ret == 0); assert(ret == 0);
assert(clen == sizeof(l) + 16); assert(clen == sizeof(l) + 16);
#ifdef SUPERVERBOSE #ifdef SUPERVERBOSE
status_trace("# encrypt l: cleartext=0x%s, AD=NULL, sn=0x%s, sk=0x%s => 0x%s", status_debug("# encrypt l: cleartext=0x%s, AD=NULL, sn=0x%s, sk=0x%s => 0x%s",
tal_hexstr(trc, &l, sizeof(l)), tal_hexstr(trc, &l, sizeof(l)),
tal_hexstr(trc, npub, sizeof(npub)), tal_hexstr(trc, npub, sizeof(npub)),
tal_hexstr(trc, &cs->sk, sizeof(cs->sk)), tal_hexstr(trc, &cs->sk, sizeof(cs->sk)),
@ -229,7 +229,7 @@ u8 *cryptomsg_encrypt_msg(const tal_t *ctx,
assert(ret == 0); assert(ret == 0);
assert(clen == mlen + 16); assert(clen == mlen + 16);
#ifdef SUPERVERBOSE #ifdef SUPERVERBOSE
status_trace("# encrypt m: cleartext=0x%s, AD=NULL, sn=0x%s, sk=0x%s => 0x%s", status_debug("# encrypt m: cleartext=0x%s, AD=NULL, sn=0x%s, sk=0x%s => 0x%s",
tal_hexstr(trc, msg, mlen), tal_hexstr(trc, msg, mlen),
tal_hexstr(trc, npub, sizeof(npub)), tal_hexstr(trc, npub, sizeof(npub)),
tal_hexstr(trc, &cs->sk, sizeof(cs->sk)), tal_hexstr(trc, &cs->sk, sizeof(cs->sk)),

2
common/dev_disconnect.c

@ -80,7 +80,7 @@ enum dev_disconnect dev_disconnect(int pkt_type)
err(1, "lseek failure"); err(1, "lseek failure");
} }
status_trace("dev_disconnect: %s%s", dev_disconnect_line, status_debug("dev_disconnect: %s%s", dev_disconnect_line,
dev_disconnect_nocommit ? "-nocommit" : ""); dev_disconnect_nocommit ? "-nocommit" : "");
if (dev_disconnect_nocommit) if (dev_disconnect_nocommit)
dev_suppress_commit = true; dev_suppress_commit = true;

2
common/ping.c

@ -82,7 +82,7 @@ const char *got_pong(const u8 *pong, size_t *num_pings_outstanding)
if (ignored[i] < ' ' || ignored[i] == 127) if (ignored[i] < ' ' || ignored[i] == 127)
break; break;
} }
status_trace("Got pong %zu bytes (%.*s...)", status_debug("Got pong %zu bytes (%.*s...)",
tal_count(ignored), i, (char *)ignored); tal_count(ignored), i, (char *)ignored);
(*num_pings_outstanding)--; (*num_pings_outstanding)--;

2
common/read_peer_msg.c

@ -185,7 +185,7 @@ bool handle_peer_gossip_or_error(struct per_peer_state *pps,
/* They're talking about a different channel? */ /* They're talking about a different channel? */
if (is_wrong_channel(msg, channel_id, &actual)) { if (is_wrong_channel(msg, channel_id, &actual)) {
status_trace("Rejecting %s for unknown channel_id %s", status_debug("Rejecting %s for unknown channel_id %s",
wire_type_name(fromwire_peektype(msg)), wire_type_name(fromwire_peektype(msg)),
type_to_string(tmpctx, struct channel_id, &actual)); type_to_string(tmpctx, struct channel_id, &actual));
sync_crypto_write(pps, sync_crypto_write(pps,

2
common/status.c

@ -44,7 +44,7 @@ static void report_logging_io(const char *why)
{ {
if (logging_io != was_logging_io) { if (logging_io != was_logging_io) {
was_logging_io = logging_io; was_logging_io = logging_io;
status_trace("%s: IO LOGGING %s", status_debug("%s: IO LOGGING %s",
why, logging_io ? "ENABLED" : "DISABLED"); why, logging_io ? "ENABLED" : "DISABLED");
} }
} }

3
common/status.h

@ -40,9 +40,6 @@ void status_io(enum log_level iodir, const char *who,
#define status_broken( ...) \ #define status_broken( ...) \
status_fmt(LOG_BROKEN, __VA_ARGS__) status_fmt(LOG_BROKEN, __VA_ARGS__)
/* FIXME: Transition */
#define status_trace(...) status_debug(__VA_ARGS__)
/* Send a failure status code with printf-style msg, and exit. */ /* Send a failure status code with printf-style msg, and exit. */
void status_failed(enum status_failreason code, void status_failed(enum status_failreason code,
const char *fmt, ...) PRINTF_FMT(2,3) NORETURN; const char *fmt, ...) PRINTF_FMT(2,3) NORETURN;

4
common/subdaemon.c

@ -64,7 +64,7 @@ static int dump_syminfo(void *data UNUSED, uintptr_t pc UNUSED,
if (!filename || !function) if (!filename || !function)
return 0; return 0;
status_trace(" %s:%u (%s)", filename, lineno, function); status_debug(" %s:%u (%s)", filename, lineno, function);
return 0; return 0;
} }
@ -74,7 +74,7 @@ static void dump_leak_backtrace(const uintptr_t *bt)
return; return;
/* First one serves as counter. */ /* First one serves as counter. */
status_trace(" backtrace:"); status_debug(" backtrace:");
for (size_t i = 1; i < bt[0]; i++) { for (size_t i = 1; i < bt[0]; i++) {
backtrace_pcinfo(backtrace_state, backtrace_pcinfo(backtrace_state,
bt[i], dump_syminfo, bt[i], dump_syminfo,

34
connectd/connectd.c

@ -353,7 +353,7 @@ static struct io_plan *retry_peer_connected(struct io_conn *conn,
struct io_plan *plan; struct io_plan *plan;
/*~ As you can see, we've had issues with this code before :( */ /*~ As you can see, we've had issues with this code before :( */
status_trace("peer %s: processing now old peer gone", status_debug("peer %s: processing now old peer gone",
type_to_string(tmpctx, struct node_id, &pr->id)); type_to_string(tmpctx, struct node_id, &pr->id));
/*~ Usually the pattern is to return this directly, but we have to free /*~ Usually the pattern is to return this directly, but we have to free
@ -378,7 +378,7 @@ static struct io_plan *peer_reconnected(struct io_conn *conn,
u8 *msg; u8 *msg;
struct peer_reconnected *pr; struct peer_reconnected *pr;
status_trace("peer %s: reconnect", status_debug("peer %s: reconnect",
type_to_string(tmpctx, struct node_id, id)); type_to_string(tmpctx, struct node_id, id));
/* Tell master to kill it: will send peer_disconnect */ /* Tell master to kill it: will send peer_disconnect */
@ -484,7 +484,7 @@ static struct io_plan *handshake_in_success(struct io_conn *conn,
{ {
struct node_id id; struct node_id id;
node_id_from_pubkey(&id, id_key); node_id_from_pubkey(&id, id_key);
status_trace("Connect IN from %s", status_debug("Connect IN from %s",
type_to_string(tmpctx, struct node_id, &id)); type_to_string(tmpctx, struct node_id, &id));
return peer_exchange_initmsg(conn, daemon, cs, &id, addr); return peer_exchange_initmsg(conn, daemon, cs, &id, addr);
} }
@ -499,7 +499,7 @@ static struct io_plan *connection_in(struct io_conn *conn, struct daemon *daemon
/* The cast here is a weird Berkeley sockets API feature... */ /* The cast here is a weird Berkeley sockets API feature... */
if (getpeername(io_conn_fd(conn), (struct sockaddr *)&s, &len) != 0) { if (getpeername(io_conn_fd(conn), (struct sockaddr *)&s, &len) != 0) {
status_trace("Failed to get peername for incoming conn: %s", status_debug("Failed to get peername for incoming conn: %s",
strerror(errno)); strerror(errno));
return io_close(conn); return io_close(conn);
} }
@ -545,7 +545,7 @@ static struct io_plan *handshake_out_success(struct io_conn *conn,
node_id_from_pubkey(&id, key); node_id_from_pubkey(&id, key);
connect->connstate = "Exchanging init messages"; connect->connstate = "Exchanging init messages";
status_trace("Connect OUT to %s", status_debug("Connect OUT to %s",
type_to_string(tmpctx, struct node_id, &id)); type_to_string(tmpctx, struct node_id, &id));
return peer_exchange_initmsg(conn, connect->daemon, cs, &id, addr); return peer_exchange_initmsg(conn, connect->daemon, cs, &id, addr);
} }
@ -563,7 +563,7 @@ struct io_plan *connection_out(struct io_conn *conn, struct connecting *connect)
} }
/* FIXME: Timeout */ /* FIXME: Timeout */
status_trace("Connected out for %s", status_debug("Connected out for %s",
type_to_string(tmpctx, struct node_id, &connect->id)); type_to_string(tmpctx, struct node_id, &connect->id));
connect->connstate = "Cryptographic handshake"; connect->connstate = "Cryptographic handshake";
@ -604,7 +604,7 @@ static void PRINTF_FMT(5,6)
addrhint); addrhint);
daemon_conn_send(daemon->master, take(msg)); daemon_conn_send(daemon->master, take(msg));
status_trace("Failed connected out for %s: %s", status_debug("Failed connected out for %s: %s",
type_to_string(tmpctx, struct node_id, id), type_to_string(tmpctx, struct node_id, id),
err); err);
} }
@ -840,7 +840,7 @@ static int make_listen_fd(int domain, void *addr, socklen_t len, bool mayfail)
status_failed(STATUS_FAIL_INTERNAL_ERROR, status_failed(STATUS_FAIL_INTERNAL_ERROR,
"Failed to create %u socket: %s", "Failed to create %u socket: %s",
domain, strerror(errno)); domain, strerror(errno));
status_trace("Failed to create %u socket: %s", status_debug("Failed to create %u socket: %s",
domain, strerror(errno)); domain, strerror(errno));
return -1; return -1;
} }
@ -856,7 +856,7 @@ static int make_listen_fd(int domain, void *addr, socklen_t len, bool mayfail)
status_failed(STATUS_FAIL_INTERNAL_ERROR, status_failed(STATUS_FAIL_INTERNAL_ERROR,
"Failed to bind on %u socket: %s", "Failed to bind on %u socket: %s",
domain, strerror(errno)); domain, strerror(errno));
status_trace("Failed to create %u socket: %s", status_debug("Failed to create %u socket: %s",
domain, strerror(errno)); domain, strerror(errno));
goto fail; goto fail;
} }
@ -887,7 +887,7 @@ static bool handle_wireaddr_listen(struct daemon *daemon,
/* We might fail if IPv6 bound to port first */ /* We might fail if IPv6 bound to port first */
fd = make_listen_fd(AF_INET, &addr, sizeof(addr), mayfail); fd = make_listen_fd(AF_INET, &addr, sizeof(addr), mayfail);
if (fd >= 0) { if (fd >= 0) {
status_trace("Created IPv4 listener on port %u", status_debug("Created IPv4 listener on port %u",
wireaddr->port); wireaddr->port);
add_listen_fd(daemon, fd, mayfail); add_listen_fd(daemon, fd, mayfail);
return true; return true;
@ -897,7 +897,7 @@ static bool handle_wireaddr_listen(struct daemon *daemon,
wireaddr_to_ipv6(wireaddr, &addr6); wireaddr_to_ipv6(wireaddr, &addr6);
fd = make_listen_fd(AF_INET6, &addr6, sizeof(addr6), mayfail); fd = make_listen_fd(AF_INET6, &addr6, sizeof(addr6), mayfail);
if (fd >= 0) { if (fd >= 0) {
status_trace("Created IPv6 listener on port %u", status_debug("Created IPv6 listener on port %u",
wireaddr->port); wireaddr->port);
add_listen_fd(daemon, fd, mayfail); add_listen_fd(daemon, fd, mayfail);
return true; return true;
@ -1041,7 +1041,7 @@ static struct wireaddr_internal *setup_listeners(const tal_t *ctx,
unlink(wa.u.sockname); unlink(wa.u.sockname);
fd = make_listen_fd(AF_UNIX, &addrun, sizeof(addrun), fd = make_listen_fd(AF_UNIX, &addrun, sizeof(addrun),
false); false);
status_trace("Created socket listener on file %s", status_debug("Created socket listener on file %s",
addrun.sun_path); addrun.sun_path);
add_listen_fd(daemon, fd, false); add_listen_fd(daemon, fd, false);
/* We don't announce socket names, though we allow /* We don't announce socket names, though we allow
@ -1172,7 +1172,7 @@ static struct io_plan *connect_init(struct io_conn *conn,
/* Resolve Tor proxy address if any: we need an addrinfo to connect() /* Resolve Tor proxy address if any: we need an addrinfo to connect()
* to. */ * to. */
if (proxyaddr) { if (proxyaddr) {
status_trace("Proxy address: %s", status_debug("Proxy address: %s",
fmt_wireaddr(tmpctx, proxyaddr)); fmt_wireaddr(tmpctx, proxyaddr));
daemon->proxyaddr = wireaddr_to_addrinfo(daemon, proxyaddr); daemon->proxyaddr = wireaddr_to_addrinfo(daemon, proxyaddr);
tal_free(proxyaddr); tal_free(proxyaddr);
@ -1180,7 +1180,7 @@ static struct io_plan *connect_init(struct io_conn *conn,
daemon->proxyaddr = NULL; daemon->proxyaddr = NULL;
if (broken_resolver(daemon)) { if (broken_resolver(daemon)) {
status_trace("Broken DNS resolver detected, will check for " status_debug("Broken DNS resolver detected, will check for "
"dummy replies"); "dummy replies");
} }
@ -1274,16 +1274,16 @@ static void add_seed_addrs(struct wireaddr_internal **addrs,
hostnames = seednames(tmpctx, id); hostnames = seednames(tmpctx, id);
for (size_t i = 0; i < tal_count(hostnames); i++) { for (size_t i = 0; i < tal_count(hostnames); i++) {
status_trace("Resolving %s", hostnames[i]); status_debug("Resolving %s", hostnames[i]);
if (!wireaddr_from_hostname(new_addrs, hostnames[i], DEFAULT_PORT, NULL, if (!wireaddr_from_hostname(new_addrs, hostnames[i], DEFAULT_PORT, NULL,
broken_reply, NULL)) { broken_reply, NULL)) {
status_trace("Could not resolve %s", hostnames[i]); status_debug("Could not resolve %s", hostnames[i]);
} else { } else {
for (size_t i = 0; i < tal_count(new_addrs); i++) { for (size_t i = 0; i < tal_count(new_addrs); i++) {
struct wireaddr_internal a; struct wireaddr_internal a;
a.itype = ADDR_INTERNAL_WIREADDR; a.itype = ADDR_INTERNAL_WIREADDR;
a.u.wireaddr = *new_addrs[i]; a.u.wireaddr = *new_addrs[i];
status_trace("Resolved %s to %s", hostnames[i], status_debug("Resolved %s to %s", hostnames[i],
type_to_string(tmpctx, struct wireaddr, type_to_string(tmpctx, struct wireaddr,
&a.u.wireaddr)); &a.u.wireaddr));
tal_arr_expand(addrs, a); tal_arr_expand(addrs, a);

2
connectd/handshake.c

@ -335,7 +335,7 @@ static struct io_plan *handshake_failed_(struct io_conn *conn,
struct handshake *h, struct handshake *h,
const char *function, int line) const char *function, int line)
{ {
status_trace("%s: handshake failed %s:%u", status_debug("%s: handshake failed %s:%u",
h->side == RESPONDER ? "Responder" : "Initiator", h->side == RESPONDER ? "Responder" : "Initiator",
function, line); function, line);
errno = EPROTO; errno = EPROTO;

6
connectd/netaddress.c

@ -204,20 +204,20 @@ static bool get_local_sockname(int af, void *saddr, socklen_t saddrlen)
{ {
int fd = socket(af, SOCK_DGRAM, 0); int fd = socket(af, SOCK_DGRAM, 0);
if (fd < 0) { if (fd < 0) {
status_trace("Failed to create %u socket: %s", status_debug("Failed to create %u socket: %s",
af, strerror(errno)); af, strerror(errno));
return false; return false;
} }
if (connect(fd, saddr, saddrlen) != 0) { if (connect(fd, saddr, saddrlen) != 0) {
status_trace("Failed to connect %u socket: %s", status_debug("Failed to connect %u socket: %s",
af, strerror(errno)); af, strerror(errno));
close(fd); close(fd);
return false; return false;
} }
if (getsockname(fd, saddr, &saddrlen) != 0) { if (getsockname(fd, saddr, &saddrlen) != 0) {
status_trace("Failed to get %u socket name: %s", status_debug("Failed to get %u socket name: %s",
af, strerror(errno)); af, strerror(errno));
close(fd); close(fd);
return false; return false;

2
connectd/peer_exchange_initmsg.c

@ -51,7 +51,7 @@ static struct io_plan *peer_init_received(struct io_conn *conn,
return read_init(conn, peer); return read_init(conn, peer);
if (!fromwire_init(peer, msg, &globalfeatures, &localfeatures)) { if (!fromwire_init(peer, msg, &globalfeatures, &localfeatures)) {
status_trace("peer %s bad fromwire_init '%s', closing", status_debug("peer %s bad fromwire_init '%s', closing",
type_to_string(tmpctx, struct node_id, &peer->id), type_to_string(tmpctx, struct node_id, &peer->id),
tal_hex(tmpctx, msg)); tal_hex(tmpctx, msg));
return io_close(conn); return io_close(conn);

2
connectd/test/run-initiator-success.c

@ -34,7 +34,7 @@ static struct io_plan *test_read(struct io_conn *conn,
struct handshake *), struct handshake *),
struct handshake *h); struct handshake *h);
#define SUPERVERBOSE status_trace #define SUPERVERBOSE status_debug
void status_fmt(enum log_level level UNUSED, const char *fmt, ...) void status_fmt(enum log_level level UNUSED, const char *fmt, ...)
{ {
va_list ap; va_list ap;

10
connectd/tor.c

@ -47,7 +47,7 @@ static struct io_plan *connect_finish2(struct io_conn *conn,
status_io(LOG_IO_IN, "proxy", status_io(LOG_IO_IN, "proxy",
connect->buffer + SIZE_OF_RESPONSE + SIZE_OF_IPV4_RESPONSE, connect->buffer + SIZE_OF_RESPONSE + SIZE_OF_IPV4_RESPONSE,
SIZE_OF_IPV6_RESPONSE - SIZE_OF_IPV4_RESPONSE); SIZE_OF_IPV6_RESPONSE - SIZE_OF_IPV4_RESPONSE);
status_trace("Now try LN connect out for host %s", connect->host); status_debug("Now try LN connect out for host %s", connect->host);
return connection_out(conn, connect->connect); return connection_out(conn, connect->connect);
} }
@ -68,17 +68,17 @@ static struct io_plan *connect_finish(struct io_conn *conn,
&connect_finish2, connect); &connect_finish2, connect);
} else if ( connect->buffer[3] == SOCKS_TYP_IPV4) { } else if ( connect->buffer[3] == SOCKS_TYP_IPV4) {
status_trace("Now try LN connect out for host %s", status_debug("Now try LN connect out for host %s",
connect->host); connect->host);
return connection_out(conn, connect->connect); return connection_out(conn, connect->connect);
} else { } else {
status_trace status_debug
("Tor connect out for host %s error invalid type return ", ("Tor connect out for host %s error invalid type return ",
connect->host); connect->host);
return io_close(conn); return io_close(conn);
} }
} else { } else {
status_trace("Tor connect out for host %s error: %x ", status_debug("Tor connect out for host %s error: %x ",
connect->host, connect->buffer[1]); connect->host, connect->buffer[1]);
return io_close(conn); return io_close(conn);
} }
@ -103,7 +103,7 @@ static struct io_plan *io_tor_connect_after_resp_to_connect(struct io_conn
status_io(LOG_IO_IN, "proxy", connect->buffer, 2); status_io(LOG_IO_IN, "proxy", connect->buffer, 2);
if (connect->buffer[1] == SOCKS_ERROR) { if (connect->buffer[1] == SOCKS_ERROR) {
status_trace("Connected out for %s error", connect->host); status_debug("Connected out for %s error", connect->host);
return io_close(conn); return io_close(conn);
} }
/* make the V5 request */ /* make the V5 request */

2
doc/HACKING.md

@ -91,7 +91,7 @@ Here's a list of parts, with notes:
Debugging Debugging
--------- ---------
You can build c-lightning with DEVELOPER=1 to use dev commands listed in ``cli/lightning-cli help``. ``./configure --enable-developer`` will do that. You can log console messages with log_info() in lightningd and status_trace() in other subdaemons. You can build c-lightning with DEVELOPER=1 to use dev commands listed in ``cli/lightning-cli help``. ``./configure --enable-developer`` will do that. You can log console messages with log_info() in lightningd and status_debug() in other subdaemons.
You can debug crashing subdaemons with the argument You can debug crashing subdaemons with the argument
`--dev-debugger=channeld`, where `channeld` is the subdaemon name. It `--dev-debugger=channeld`, where `channeld` is the subdaemon name. It

10
gossipd/gossip_store.c

@ -321,7 +321,7 @@ bool gossip_store_compact(struct gossip_store *gs)
if (gs->disable_compaction) if (gs->disable_compaction)
return false; return false;
status_trace( status_debug(
"Compacting gossip_store with %zu entries, %zu of which are stale", "Compacting gossip_store with %zu entries, %zu of which are stale",
gs->count, gs->deleted); gs->count, gs->deleted);
@ -419,7 +419,7 @@ bool gossip_store_compact(struct gossip_store *gs)
" %s", " %s",
strerror(errno)); strerror(errno));
status_trace( status_debug(
"Compaction completed: dropped %zu messages, new count %zu, len %"PRIu64, "Compaction completed: dropped %zu messages, new count %zu, len %"PRIu64,
deleted, count, len); deleted, count, len);
gs->count = count; gs->count = count;
@ -435,7 +435,7 @@ bool gossip_store_compact(struct gossip_store *gs)
unlink_disable: unlink_disable:
unlink(GOSSIP_STORE_TEMP_FILENAME); unlink(GOSSIP_STORE_TEMP_FILENAME);
disable: disable:
status_trace("Encountered an error while compacting, disabling " status_debug("Encountered an error while compacting, disabling "
"future compactions."); "future compactions.");
gs->disable_compaction = true; gs->disable_compaction = true;
return false; return false;
@ -734,9 +734,9 @@ corrupt:
contents_ok = false; contents_ok = false;
out: out:
gs->writable = true; gs->writable = true;
status_trace("total store load time: %"PRIu64" msec", status_debug("total store load time: %"PRIu64" msec",
time_to_msec(time_between(time_now(), start))); time_to_msec(time_between(time_now(), start)));
status_trace("gossip_store: Read %zu/%zu/%zu/%zu cannounce/cupdate/nannounce/cdelete from store (%zu deleted) in %"PRIu64" bytes", status_debug("gossip_store: Read %zu/%zu/%zu/%zu cannounce/cupdate/nannounce/cdelete from store (%zu deleted) in %"PRIu64" bytes",
stats[0], stats[1], stats[2], stats[3], gs->deleted, stats[0], stats[1], stats[2], stats[3], gs->deleted,
gs->len); gs->len);

36
gossipd/gossipd.c

@ -335,12 +335,12 @@ static u8 *zencode(const tal_t *ctx, const u8 *scids, size_t len)
z = tal_arr(ctx, u8, compressed_len); z = tal_arr(ctx, u8, compressed_len);
err = compress2(z, &compressed_len, scids, len, Z_DEFAULT_COMPRESSION); err = compress2(z, &compressed_len, scids, len, Z_DEFAULT_COMPRESSION);
if (err == Z_OK) { if (err == Z_OK) {
status_trace("compressed %zu into %lu", status_debug("compressed %zu into %lu",
len, compressed_len); len, compressed_len);
tal_resize(&z, compressed_len); tal_resize(&z, compressed_len);
return z; return z;
} }
status_trace("compress %zu returned %i:" status_debug("compress %zu returned %i:"
" not compresssing", len, err); " not compresssing", len, err);
return NULL; return NULL;
} }
@ -434,7 +434,7 @@ static void setup_gossip_range(struct peer *peer)
return; return;
} }
status_trace("Setting peer %s to gossip level %s", status_debug("Setting peer %s to gossip level %s",
type_to_string(tmpctx, struct node_id, &peer->id), type_to_string(tmpctx, struct node_id, &peer->id),
peer->gossip_level == GOSSIP_HIGH ? "HIGH" peer->gossip_level == GOSSIP_HIGH ? "HIGH"
: peer->gossip_level == GOSSIP_MEDIUM ? "MEDIUM" : peer->gossip_level == GOSSIP_MEDIUM ? "MEDIUM"
@ -697,7 +697,7 @@ static bool query_short_channel_ids(struct daemon *daemon,
peer->scid_query_outstanding = true; peer->scid_query_outstanding = true;
peer->scid_query_was_internal = internal; peer->scid_query_was_internal = internal;
status_trace("%s: sending query for %zu scids", status_debug("%s: sending query for %zu scids",
type_to_string(tmpctx, struct node_id, &peer->id), type_to_string(tmpctx, struct node_id, &peer->id),
tal_count(scids)); tal_count(scids));
return true; return true;
@ -820,7 +820,7 @@ static const u8 *handle_query_short_channel_ids(struct peer *peer, const u8 *msg
#endif #endif
if (!bitcoin_blkid_eq(&peer->daemon->chain_hash, &chain)) { if (!bitcoin_blkid_eq(&peer->daemon->chain_hash, &chain)) {
status_trace("%s sent query_short_channel_ids chainhash %s", status_debug("%s sent query_short_channel_ids chainhash %s",
type_to_string(tmpctx, struct node_id, &peer->id), type_to_string(tmpctx, struct node_id, &peer->id),
type_to_string(tmpctx, struct bitcoin_blkid, &chain)); type_to_string(tmpctx, struct bitcoin_blkid, &chain));
return NULL; return NULL;
@ -1199,7 +1199,7 @@ static u8 *handle_query_channel_range(struct peer *peer, const u8 *msg)
/* If they ask for the wrong chain, we give an empty response /* If they ask for the wrong chain, we give an empty response
* with the `complete` flag unset */ * with the `complete` flag unset */
if (!bitcoin_blkid_eq(&peer->daemon->chain_hash, &chain_hash)) { if (!bitcoin_blkid_eq(&peer->daemon->chain_hash, &chain_hash)) {
status_trace("%s sent query_channel_range chainhash %s", status_debug("%s sent query_channel_range chainhash %s",
type_to_string(tmpctx, struct node_id, &peer->id), type_to_string(tmpctx, struct node_id, &peer->id),
type_to_string(tmpctx, struct bitcoin_blkid, type_to_string(tmpctx, struct bitcoin_blkid,
&chain_hash)); &chain_hash));
@ -1848,7 +1848,7 @@ static bool handle_get_update(struct peer *peer, const u8 *msg)
update = gossip_store_get(tmpctx, rstate->gs, update = gossip_store_get(tmpctx, rstate->gs,
chan->half[direction].bcast.index); chan->half[direction].bcast.index);
out: out:
status_trace("peer %s schanid %s: %s update", status_debug("peer %s schanid %s: %s update",
type_to_string(tmpctx, struct node_id, &peer->id), type_to_string(tmpctx, struct node_id, &peer->id),
type_to_string(tmpctx, struct short_channel_id, &scid), type_to_string(tmpctx, struct short_channel_id, &scid),
update ? "got" : "no"); update ? "got" : "no");
@ -1908,7 +1908,7 @@ static bool handle_local_channel_update(struct peer *peer, const u8 *msg)
/* Can theoretically happen if channel just closed. */ /* Can theoretically happen if channel just closed. */
chan = get_channel(peer->daemon->rstate, &scid); chan = get_channel(peer->daemon->rstate, &scid);
if (!chan) { if (!chan) {
status_trace("peer %s local_channel_update for unknown %s", status_debug("peer %s local_channel_update for unknown %s",
type_to_string(tmpctx, struct node_id, &peer->id), type_to_string(tmpctx, struct node_id, &peer->id),
type_to_string(tmpctx, struct short_channel_id, type_to_string(tmpctx, struct short_channel_id,
&scid)); &scid));
@ -2259,7 +2259,7 @@ static void gossip_send_keepalive_update(struct daemon *daemon,
const struct chan *chan, const struct chan *chan,
const struct half_chan *hc) const struct half_chan *hc)
{ {
status_trace("Sending keepalive channel_update for %s", status_debug("Sending keepalive channel_update for %s",
type_to_string(tmpctx, struct short_channel_id, type_to_string(tmpctx, struct short_channel_id,
&chan->scid)); &chan->scid));
@ -2505,7 +2505,7 @@ static struct io_plan *getroute_req(struct io_conn *conn, struct daemon *daemon,
&max_hops)) &max_hops))
master_badmsg(WIRE_GOSSIP_GETROUTE_REQUEST, msg); master_badmsg(WIRE_GOSSIP_GETROUTE_REQUEST, msg);
status_trace("Trying to find a route from %s to %s for %s", status_debug("Trying to find a route from %s to %s for %s",
source source
? type_to_string(tmpctx, struct node_id, source) : "(me)", ? type_to_string(tmpctx, struct node_id, source) : "(me)",
type_to_string(tmpctx, struct node_id, &destination), type_to_string(tmpctx, struct node_id, &destination),
@ -2742,7 +2742,7 @@ static struct io_plan *ping_req(struct io_conn *conn, struct daemon *daemon,
status_failed(STATUS_FAIL_MASTER_IO, "Oversize ping"); status_failed(STATUS_FAIL_MASTER_IO, "Oversize ping");
queue_peer_msg(peer, take(ping)); queue_peer_msg(peer, take(ping));
status_trace("sending ping expecting %sresponse", status_debug("sending ping expecting %sresponse",
num_pong_bytes >= 65532 ? "no " : ""); num_pong_bytes >= 65532 ? "no " : "");
/* BOLT #1: /* BOLT #1:
@ -2813,10 +2813,10 @@ static struct io_plan *get_incoming_channels(struct io_conn *conn,
if (!fromwire_gossip_get_incoming_channels(tmpctx, msg, &exposeprivate)) if (!fromwire_gossip_get_incoming_channels(tmpctx, msg, &exposeprivate))
master_badmsg(WIRE_GOSSIP_GET_INCOMING_CHANNELS, msg); master_badmsg(WIRE_GOSSIP_GET_INCOMING_CHANNELS, msg);
status_trace("exposeprivate = %s", status_debug("exposeprivate = %s",
exposeprivate ? (*exposeprivate ? "TRUE" : "FALSE") : "NULL"); exposeprivate ? (*exposeprivate ? "TRUE" : "FALSE") : "NULL");
status_trace("msg = %s", tal_hex(tmpctx, msg)); status_debug("msg = %s", tal_hex(tmpctx, msg));
status_trace("always_expose = %u, never_expose = %u", status_debug("always_expose = %u, never_expose = %u",
always_expose(exposeprivate), never_expose(exposeprivate)); always_expose(exposeprivate), never_expose(exposeprivate));
has_public = always_expose(exposeprivate); has_public = always_expose(exposeprivate);
@ -3014,7 +3014,7 @@ static struct io_plan *dev_set_max_scids_encode_size(struct io_conn *conn,
&max_encoding_bytes)) &max_encoding_bytes))
master_badmsg(WIRE_GOSSIP_DEV_SET_MAX_SCIDS_ENCODE_SIZE, msg); master_badmsg(WIRE_GOSSIP_DEV_SET_MAX_SCIDS_ENCODE_SIZE, msg);
status_trace("Set max_scids_encode_bytes to %u", max_encoding_bytes); status_debug("Set max_scids_encode_bytes to %u", max_encoding_bytes);
return daemon_conn_read_next(conn, daemon->master); return daemon_conn_read_next(conn, daemon->master);
} }
@ -3077,13 +3077,13 @@ static struct io_plan *get_channel_peer(struct io_conn *conn,
chan = get_channel(daemon->rstate, &scid); chan = get_channel(daemon->rstate, &scid);
if (!chan) { if (!chan) {
status_trace("Failed to resolve channel %s", status_debug("Failed to resolve channel %s",
type_to_string(tmpctx, struct short_channel_id, &scid)); type_to_string(tmpctx, struct short_channel_id, &scid));
key = NULL; key = NULL;
} else if (local_direction(daemon, chan, &direction)) { } else if (local_direction(daemon, chan, &direction)) {
key = &chan->nodes[!direction]->id; key = &chan->nodes[!direction]->id;
} else { } else {
status_trace("Resolved channel %s was not local", status_debug("Resolved channel %s was not local",
type_to_string(tmpctx, struct short_channel_id, type_to_string(tmpctx, struct short_channel_id,
&scid)); &scid));
key = NULL; key = NULL;
@ -3237,7 +3237,7 @@ static struct io_plan *handle_outpoint_spent(struct io_conn *conn,
chan = get_channel(rstate, &scid); chan = get_channel(rstate, &scid);
if (chan) { if (chan) {
status_trace( status_debug(
"Deleting channel %s due to the funding outpoint being " "Deleting channel %s due to the funding outpoint being "
"spent", "spent",
type_to_string(msg, struct short_channel_id, &scid)); type_to_string(msg, struct short_channel_id, &scid));

40
gossipd/routing.c

@ -411,7 +411,7 @@ static void init_half_chan(struct routing_state *rstate,
static void bad_gossip_order(const u8 *msg, const char *source, static void bad_gossip_order(const u8 *msg, const char *source,
const char *details) const char *details)
{ {
status_trace("Bad gossip order from %s: %s before announcement %s", status_debug("Bad gossip order from %s: %s before announcement %s",
source, wire_type_name(fromwire_peektype(msg)), source, wire_type_name(fromwire_peektype(msg)),
details); details);
} }
@ -1592,7 +1592,7 @@ u8 *handle_channel_announcement(struct routing_state *rstate,
* or not. * or not.
*/ */
if (!features_supported(features, NULL)) { if (!features_supported(features, NULL)) {
status_trace("Ignoring channel announcement, unsupported features %s.", status_debug("Ignoring channel announcement, unsupported features %s.",
tal_hex(pending, features)); tal_hex(pending, features));
goto ignored; goto ignored;
} }
@ -1605,7 +1605,7 @@ u8 *handle_channel_announcement(struct routing_state *rstate,
*/ */
if (!bitcoin_blkid_eq(&chain_hash, if (!bitcoin_blkid_eq(&chain_hash,
&rstate->chainparams->genesis_blockhash)) { &rstate->chainparams->genesis_blockhash)) {
status_trace( status_debug(
"Received channel_announcement %s for unknown chain %s", "Received channel_announcement %s for unknown chain %s",
type_to_string(pending, struct short_channel_id, type_to_string(pending, struct short_channel_id,
&pending->short_channel_id), &pending->short_channel_id),
@ -1635,7 +1635,7 @@ u8 *handle_channel_announcement(struct routing_state *rstate,
goto malformed; goto malformed;
} }
status_trace("Received channel_announcement for channel %s", status_debug("Received channel_announcement for channel %s",
type_to_string(tmpctx, struct short_channel_id, type_to_string(tmpctx, struct short_channel_id,
&pending->short_channel_id)); &pending->short_channel_id));
@ -1676,7 +1676,7 @@ static void process_pending_channel_update(struct routing_state *rstate,
/* FIXME: We don't remember who sent us updates, so can't error them */ /* FIXME: We don't remember who sent us updates, so can't error them */
err = handle_channel_update(rstate, cupdate, "pending update", NULL); err = handle_channel_update(rstate, cupdate, "pending update", NULL);
if (err) { if (err) {
status_trace("Pending channel_update for %s: %s", status_debug("Pending channel_update for %s: %s",
type_to_string(tmpctx, struct short_channel_id, scid), type_to_string(tmpctx, struct short_channel_id, scid),
sanitize_error(tmpctx, err, NULL)); sanitize_error(tmpctx, err, NULL));
tal_free(err); tal_free(err);
@ -1703,7 +1703,7 @@ bool handle_pending_cannouncement(struct routing_state *rstate,
* - MUST ignore the message. * - MUST ignore the message.
*/ */
if (tal_count(outscript) == 0) { if (tal_count(outscript) == 0) {
status_trace("channel_announcement: no unspent txout %s", status_debug("channel_announcement: no unspent txout %s",
type_to_string(pending, struct short_channel_id, type_to_string(pending, struct short_channel_id,
scid)); scid));
tal_free(pending); tal_free(pending);
@ -1726,7 +1726,7 @@ bool handle_pending_cannouncement(struct routing_state *rstate,
&pending->bitcoin_key_2)); &pending->bitcoin_key_2));
if (!scripteq(s, outscript)) { if (!scripteq(s, outscript)) {
status_trace("channel_announcement: txout %s expectes %s, got %s", status_debug("channel_announcement: txout %s expectes %s, got %s",
type_to_string(pending, struct short_channel_id, type_to_string(pending, struct short_channel_id,
scid), scid),
tal_hex(tmpctx, s), tal_hex(tmpctx, outscript)); tal_hex(tmpctx, s), tal_hex(tmpctx, outscript));
@ -1760,7 +1760,7 @@ static void update_pending(struct pending_cannouncement *pending,
if (pending->update_timestamps[direction] < timestamp) { if (pending->update_timestamps[direction] < timestamp) {
if (pending->updates[direction]) { if (pending->updates[direction]) {
status_trace("Replacing existing update"); status_debug("Replacing existing update");
tal_free(pending->updates[direction]); tal_free(pending->updates[direction]);
} }
pending->updates[direction] = tal_dup_arr(pending, u8, update, tal_count(update), 0); pending->updates[direction] = tal_dup_arr(pending, u8, update, tal_count(update), 0);
@ -2035,7 +2035,7 @@ u8 *handle_channel_update(struct routing_state *rstate, const u8 *update TAKES,
*/ */
if (!bitcoin_blkid_eq(&chain_hash, if (!bitcoin_blkid_eq(&chain_hash,
&rstate->chainparams->genesis_blockhash)) { &rstate->chainparams->genesis_blockhash)) {
status_trace("Received channel_update for unknown chain %s", status_debug("Received channel_update for unknown chain %s",
type_to_string(tmpctx, struct bitcoin_blkid, type_to_string(tmpctx, struct bitcoin_blkid,
&chain_hash)); &chain_hash));
return NULL; return NULL;
@ -2050,7 +2050,7 @@ u8 *handle_channel_update(struct routing_state *rstate, const u8 *update TAKES,
/* If we have an unvalidated channel, just queue on that */ /* If we have an unvalidated channel, just queue on that */
pending = find_pending_cannouncement(rstate, &short_channel_id); pending = find_pending_cannouncement(rstate, &short_channel_id);
if (pending) { if (pending) {
status_trace("Updated pending announce with update %s/%u", status_debug("Updated pending announce with update %s/%u",
type_to_string(tmpctx, type_to_string(tmpctx,
struct short_channel_id, struct short_channel_id,
&short_channel_id), &short_channel_id),
@ -2087,7 +2087,7 @@ u8 *handle_channel_update(struct routing_state *rstate, const u8 *update TAKES,
return err; return err;
} }
status_trace("Received channel_update for channel %s/%d now %s (from %s)", status_debug("Received channel_update for channel %s/%d now %s (from %s)",
type_to_string(tmpctx, struct short_channel_id, type_to_string(tmpctx, struct short_channel_id,
&short_channel_id), &short_channel_id),
channel_flags & 0x01, channel_flags & 0x01,
@ -2122,7 +2122,7 @@ struct wireaddr *read_addresses(const tal_t *ctx, const u8 *ser)
/* Parsing address failed */ /* Parsing address failed */
return tal_free(wireaddrs); return tal_free(wireaddrs);
/* Unknown type, stop there. */ /* Unknown type, stop there. */
status_trace("read_addresses: unknown address type %u", status_debug("read_addresses: unknown address type %u",
cursor[0]); cursor[0]);
break; break;
} }
@ -2158,7 +2158,7 @@ bool routing_add_node_announcement(struct routing_state *rstate,
/* Only log this if *not* loading from store. */ /* Only log this if *not* loading from store. */
if (!index) if (!index)
status_trace("Received node_announcement for node %s", status_debug("Received node_announcement for node %s",
type_to_string(tmpctx, struct node_id, &node_id)); type_to_string(tmpctx, struct node_id, &node_id));
node = get_node(rstate, &node_id); node = get_node(rstate, &node_id);
@ -2263,7 +2263,7 @@ u8 *handle_node_announcement(struct routing_state *rstate, const u8 *node_ann)
* - SHOULD NOT connect to the node. * - SHOULD NOT connect to the node.
*/ */
if (!features_supported(features, NULL)) { if (!features_supported(features, NULL)) {
status_trace("Ignoring node announcement for node %s, unsupported features %s.", status_debug("Ignoring node announcement for node %s, unsupported features %s.",
type_to_string(tmpctx, struct node_id, &node_id), type_to_string(tmpctx, struct node_id, &node_id),
tal_hex(tmpctx, features)); tal_hex(tmpctx, features));
return NULL; return NULL;
@ -2418,7 +2418,7 @@ void routing_failure(struct routing_state *rstate,
{ {
struct chan **pruned = tal_arr(tmpctx, struct chan *, 0); struct chan **pruned = tal_arr(tmpctx, struct chan *, 0);
status_trace("Received routing failure 0x%04x (%s), " status_debug("Received routing failure 0x%04x (%s), "
"erring node %s, " "erring node %s, "
"channel %s/%u", "channel %s/%u",
(int) failcode, onion_type_name(failcode), (int) failcode, onion_type_name(failcode),
@ -2458,7 +2458,7 @@ void routing_failure(struct routing_state *rstate,
struct chan_map_iter i; struct chan_map_iter i;
struct chan *c; struct chan *c;
status_trace("Deleting node %s", status_debug("Deleting node %s",
type_to_string(tmpctx, type_to_string(tmpctx,
struct node_id, struct node_id,
&node->id)); &node->id));
@ -2484,7 +2484,7 @@ void routing_failure(struct routing_state *rstate,
erring_node_id)) erring_node_id))
return; return;
status_trace("Deleting channel %s", status_debug("Deleting channel %s",
type_to_string(tmpctx, type_to_string(tmpctx,
struct short_channel_id, struct short_channel_id,
scid)); scid));
@ -2519,7 +2519,7 @@ void route_prune(struct routing_state *rstate)
|| chan->half[0].bcast.timestamp < highwater) || chan->half[0].bcast.timestamp < highwater)
&& (!is_halfchan_defined(&chan->half[1]) && (!is_halfchan_defined(&chan->half[1])
|| chan->half[1].bcast.timestamp < highwater)) { || chan->half[1].bcast.timestamp < highwater)) {
status_trace( status_debug(
"Pruning channel %s from network view (ages %"PRIu64" and %"PRIu64"s)", "Pruning channel %s from network view (ages %"PRIu64" and %"PRIu64"s)",
type_to_string(tmpctx, struct short_channel_id, type_to_string(tmpctx, struct short_channel_id,
&chan->scid), &chan->scid),
@ -2567,11 +2567,11 @@ bool handle_local_add_channel(struct routing_state *rstate,
/* Can happen on channeld restart. */ /* Can happen on channeld restart. */
if (get_channel(rstate, &scid)) { if (get_channel(rstate, &scid)) {
status_trace("Attempted to local_add_channel a known channel"); status_debug("Attempted to local_add_channel a known channel");
return true; return true;
} }
status_trace("local_add_channel %s", status_debug("local_add_channel %s",
type_to_string(tmpctx, struct short_channel_id, &scid)); type_to_string(tmpctx, struct short_channel_id, &scid));
/* Create new (unannounced) channel */ /* Create new (unannounced) channel */

8
gossipd/test/run-find_route.c

@ -193,9 +193,9 @@ int main(void)
node_id_from_privkey(&tmp, &c); node_id_from_privkey(&tmp, &c);
new_node(rstate, &c); new_node(rstate, &c);
status_trace("A = %s", type_to_string(tmpctx, struct node_id, &a)); status_debug("A = %s", type_to_string(tmpctx, struct node_id, &a));
status_trace("B = %s", type_to_string(tmpctx, struct node_id, &b)); status_debug("B = %s", type_to_string(tmpctx, struct node_id, &b));
status_trace("C = %s", type_to_string(tmpctx, struct node_id, &c)); status_debug("C = %s", type_to_string(tmpctx, struct node_id, &c));
add_connection(rstate, &b, &c, 1, 1, 1); add_connection(rstate, &b, &c, 1, 1, 1);
route = find_route(tmpctx, rstate, &a, &c, AMOUNT_MSAT(1000), riskfactor, 0.0, NULL, route = find_route(tmpctx, rstate, &a, &c, AMOUNT_MSAT(1000), riskfactor, 0.0, NULL,
@ -208,7 +208,7 @@ int main(void)
memset(&tmp, 'd', sizeof(tmp)); memset(&tmp, 'd', sizeof(tmp));
node_id_from_privkey(&tmp, &d); node_id_from_privkey(&tmp, &d);
new_node(rstate, &d); new_node(rstate, &d);
status_trace("D = %s", type_to_string(tmpctx, struct node_id, &d)); status_debug("D = %s", type_to_string(tmpctx, struct node_id, &d));
add_connection(rstate, &a, &d, 0, 2, 1); add_connection(rstate, &a, &d, 0, 2, 1);
add_connection(rstate, &d, &c, 0, 2, 1); add_connection(rstate, &d, &c, 0, 2, 1);

2
hsmd/hsmd.c

@ -1355,7 +1355,7 @@ static struct io_plan *pass_client_hsmfd(struct io_conn *conn,
status_failed(STATUS_FAIL_INTERNAL_ERROR, "creating fds: %s", status_failed(STATUS_FAIL_INTERNAL_ERROR, "creating fds: %s",
strerror(errno)); strerror(errno));
status_trace("new_client: %"PRIu64, dbid); status_debug("new_client: %"PRIu64, dbid);
new_client(c, c->chainparams, &id, dbid, capabilities, fds[0]); new_client(c, c->chainparams, &id, dbid, capabilities, fds[0]);
/*~ We stash this in a global, because we need to get both the fd and /*~ We stash this in a global, because we need to get both the fd and

66
onchaind/onchaind.c

@ -148,7 +148,7 @@ static bool grind_htlc_tx_fee(struct amount_sat *fee,
&keyset->other_htlc_key, remotesig)) &keyset->other_htlc_key, remotesig))
continue; continue;
status_trace("grind feerate_per_kw for %"PRIu64" = %"PRIu64, status_debug("grind feerate_per_kw for %"PRIu64" = %"PRIu64,
weight, i); weight, i);
return true; return true;
} }
@ -422,7 +422,7 @@ new_tracked_output(const struct chainparams *chainparams,
{ {
struct tracked_output *out = tal(*outs, struct tracked_output); struct tracked_output *out = tal(*outs, struct tracked_output);
status_trace("Tracking output %u of %s: %s/%s", status_debug("Tracking output %u of %s: %s/%s",
outnum, outnum,
type_to_string(tmpctx, struct bitcoin_txid, txid), type_to_string(tmpctx, struct bitcoin_txid, txid),
tx_type_name(tx_type), tx_type_name(tx_type),
@ -457,7 +457,7 @@ new_tracked_output(const struct chainparams *chainparams,
static void ignore_output(struct tracked_output *out) static void ignore_output(struct tracked_output *out)
{ {
status_trace("Ignoring output %u of %s: %s/%s", status_debug("Ignoring output %u of %s: %s/%s",
out->outnum, out->outnum,
type_to_string(tmpctx, struct bitcoin_txid, &out->txid), type_to_string(tmpctx, struct bitcoin_txid, &out->txid),
tx_type_name(out->tx_type), tx_type_name(out->tx_type),
@ -512,7 +512,7 @@ static void proposal_meets_depth(struct tracked_output *out)
return; return;
} }
status_trace("Broadcasting %s (%s) to resolve %s/%s", status_debug("Broadcasting %s (%s) to resolve %s/%s",
tx_type_name(out->proposal->tx_type), tx_type_name(out->proposal->tx_type),
type_to_string(tmpctx, struct bitcoin_tx, out->proposal->tx), type_to_string(tmpctx, struct bitcoin_tx, out->proposal->tx),
tx_type_name(out->tx_type), tx_type_name(out->tx_type),
@ -536,7 +536,7 @@ static void propose_resolution(struct tracked_output *out,
unsigned int depth_required, unsigned int depth_required,
enum tx_type tx_type) enum tx_type tx_type)
{ {
status_trace("Propose handling %s/%s by %s (%s) after %u blocks", status_debug("Propose handling %s/%s by %s (%s) after %u blocks",
tx_type_name(out->tx_type), tx_type_name(out->tx_type),
output_type_name(out->output_type), output_type_name(out->output_type),
tx_type_name(tx_type), tx_type_name(tx_type),
@ -637,7 +637,7 @@ static bool resolved_by_proposal(struct tracked_output *out,
out->resolved = tal(out, struct resolution); out->resolved = tal(out, struct resolution);
bitcoin_txid(tx, &out->resolved->txid); bitcoin_txid(tx, &out->resolved->txid);
status_trace("Resolved %s/%s by our proposal %s (%s)", status_debug("Resolved %s/%s by our proposal %s (%s)",
tx_type_name(out->tx_type), tx_type_name(out->tx_type),
output_type_name(out->output_type), output_type_name(out->output_type),
tx_type_name(out->proposal->tx_type), tx_type_name(out->proposal->tx_type),
@ -659,7 +659,7 @@ static void resolved_by_other(struct tracked_output *out,
out->resolved->depth = 0; out->resolved->depth = 0;
out->resolved->tx_type = tx_type; out->resolved->tx_type = tx_type;
status_trace("Resolved %s/%s by %s (%s)", status_debug("Resolved %s/%s by %s (%s)",
tx_type_name(out->tx_type), tx_type_name(out->tx_type),
output_type_name(out->output_type), output_type_name(out->output_type),
tx_type_name(tx_type), tx_type_name(tx_type),
@ -901,7 +901,7 @@ static void handle_htlc_onchain_fulfill(struct tracked_output *out,
&out->htlc.ripemd)); &out->htlc.ripemd));
/* Tell master we found a preimage. */ /* Tell master we found a preimage. */
status_trace("%s/%s gave us preimage %s", status_debug("%s/%s gave us preimage %s",
tx_type_name(out->tx_type), tx_type_name(out->tx_type),
output_type_name(out->output_type), output_type_name(out->output_type),
type_to_string(tmpctx, struct preimage, &preimage)); type_to_string(tmpctx, struct preimage, &preimage));
@ -1097,7 +1097,7 @@ static void output_spent(const struct chainparams *chainparams,
bitcoin_tx_input_get_txid(tx, input_num, &txid); bitcoin_tx_input_get_txid(tx, input_num, &txid);
/* Not interesting to us, so unwatch the tx and all its outputs */ /* Not interesting to us, so unwatch the tx and all its outputs */
status_trace("Notified about tx %s output %u spend, but we don't care", status_debug("Notified about tx %s output %u spend, but we don't care",
type_to_string(tmpctx, struct bitcoin_txid, &txid), type_to_string(tmpctx, struct bitcoin_txid, &txid),
tx->wtx->inputs[input_num].index); tx->wtx->inputs[input_num].index);
@ -1108,7 +1108,7 @@ static void update_resolution_depth(struct tracked_output *out, u32 depth)
{ {
bool reached_reasonable_depth; bool reached_reasonable_depth;
status_trace("%s/%s->%s depth %u", status_debug("%s/%s->%s depth %u",
tx_type_name(out->tx_type), tx_type_name(out->tx_type),
output_type_name(out->output_type), output_type_name(out->output_type),
tx_type_name(out->resolved->tx_type), tx_type_name(out->resolved->tx_type),
@ -1131,7 +1131,7 @@ static void update_resolution_depth(struct tracked_output *out, u32 depth)
|| out->resolved->tx_type == OUR_HTLC_TIMEOUT_TO_US) || out->resolved->tx_type == OUR_HTLC_TIMEOUT_TO_US)
&& reached_reasonable_depth) { && reached_reasonable_depth) {
u8 *msg; u8 *msg;
status_trace("%s/%s reached reasonable depth %u", status_debug("%s/%s reached reasonable depth %u",
tx_type_name(out->tx_type), tx_type_name(out->tx_type),
output_type_name(out->output_type), output_type_name(out->output_type),
depth); depth);
@ -1150,7 +1150,7 @@ static void tx_new_depth(struct tracked_output **outs,
if (bitcoin_txid_eq(&outs[0]->resolved->txid, txid) if (bitcoin_txid_eq(&outs[0]->resolved->txid, txid)
&& depth >= reasonable_depth && depth >= reasonable_depth
&& missing_htlc_msgs) { && missing_htlc_msgs) {
status_trace("Sending %zu missing htlc messages", status_debug("Sending %zu missing htlc messages",
tal_count(missing_htlc_msgs)); tal_count(missing_htlc_msgs));
for (i = 0; i < tal_count(missing_htlc_msgs); i++) for (i = 0; i < tal_count(missing_htlc_msgs); i++)
wire_sync_write(REQ_FD, missing_htlc_msgs[i]); wire_sync_write(REQ_FD, missing_htlc_msgs[i]);
@ -1373,7 +1373,7 @@ static void wait_for_resolved(const struct chainparams *chainparams,
u32 input_num, depth, tx_blockheight; u32 input_num, depth, tx_blockheight;
struct preimage preimage; struct preimage preimage;
status_trace("Got new message %s", status_debug("Got new message %s",
onchain_wire_type_name(fromwire_peektype(msg))); onchain_wire_type_name(fromwire_peektype(msg)));
if (fromwire_onchain_depth(msg, &txid, &depth)) if (fromwire_onchain_depth(msg, &txid, &depth))
@ -1727,7 +1727,7 @@ static void handle_our_unilateral(const struct bitcoin_tx *tx,
status_failed(STATUS_FAIL_INTERNAL_ERROR, status_failed(STATUS_FAIL_INTERNAL_ERROR,
"Deriving keyset for %"PRIu64, commit_num); "Deriving keyset for %"PRIu64, commit_num);
status_trace("Deconstructing unilateral tx: %"PRIu64 status_debug("Deconstructing unilateral tx: %"PRIu64
" using keyset: " " using keyset: "
" self_revocation_key: %s" " self_revocation_key: %s"
" self_delayed_payment_key: %s" " self_delayed_payment_key: %s"
@ -1760,15 +1760,15 @@ static void handle_our_unilateral(const struct bitcoin_tx *tx,
/* Calculate all the HTLC scripts so we can match them */ /* Calculate all the HTLC scripts so we can match them */
htlc_scripts = derive_htlc_scripts(htlcs, LOCAL); htlc_scripts = derive_htlc_scripts(htlcs, LOCAL);
status_trace("Script to-me: %u: %s (%s)", status_debug("Script to-me: %u: %s (%s)",
to_self_delay[LOCAL], to_self_delay[LOCAL],
tal_hex(tmpctx, script[LOCAL]), tal_hex(tmpctx, script[LOCAL]),
tal_hex(tmpctx, local_wscript)); tal_hex(tmpctx, local_wscript));
status_trace("Script to-them: %s", status_debug("Script to-them: %s",
tal_hex(tmpctx, script[REMOTE])); tal_hex(tmpctx, script[REMOTE]));
for (i = 0; i < tx->wtx->num_outputs; i++) { for (i = 0; i < tx->wtx->num_outputs; i++) {
status_trace("Output %zu: %s", i, status_debug("Output %zu: %s", i,
tal_hex(tmpctx, bitcoin_tx_output_get_script( tal_hex(tmpctx, bitcoin_tx_output_get_script(
tmpctx, tx, i))); tmpctx, tx, i)));
} }
@ -2013,7 +2013,7 @@ static void handle_their_cheat(const struct bitcoin_tx *tx,
type_to_string(tmpctx, struct secret, type_to_string(tmpctx, struct secret,
remote_per_commitment_secret)); remote_per_commitment_secret));
status_trace("Deriving keyset %"PRIu64 status_debug("Deriving keyset %"PRIu64
": per_commit_point=%s" ": per_commit_point=%s"
" self_payment_basepoint=%s" " self_payment_basepoint=%s"
" other_payment_basepoint=%s" " other_payment_basepoint=%s"
@ -2046,7 +2046,7 @@ static void handle_their_cheat(const struct bitcoin_tx *tx,
status_failed(STATUS_FAIL_INTERNAL_ERROR, status_failed(STATUS_FAIL_INTERNAL_ERROR,
"Deriving keyset for %"PRIu64, commit_num); "Deriving keyset for %"PRIu64, commit_num);
status_trace("Deconstructing revoked unilateral tx: %"PRIu64 status_debug("Deconstructing revoked unilateral tx: %"PRIu64
" using keyset: " " using keyset: "
" self_revocation_key: %s" " self_revocation_key: %s"
" self_delayed_payment_key: %s" " self_delayed_payment_key: %s"
@ -2079,15 +2079,15 @@ static void handle_their_cheat(const struct bitcoin_tx *tx,
/* Calculate all the HTLC scripts so we can match them */ /* Calculate all the HTLC scripts so we can match them */
htlc_scripts = derive_htlc_scripts(htlcs, REMOTE); htlc_scripts = derive_htlc_scripts(htlcs, REMOTE);
status_trace("Script to-them: %u: %s (%s)", status_debug("Script to-them: %u: %s (%s)",
to_self_delay[REMOTE], to_self_delay[REMOTE],
tal_hex(tmpctx, script[REMOTE]), tal_hex(tmpctx, script[REMOTE]),
tal_hex(tmpctx, remote_wscript)); tal_hex(tmpctx, remote_wscript));
status_trace("Script to-me: %s", status_debug("Script to-me: %s",
tal_hex(tmpctx, script[LOCAL])); tal_hex(tmpctx, script[LOCAL]));
for (i = 0; i < tx->wtx->num_outputs; i++) { for (i = 0; i < tx->wtx->num_outputs; i++) {
status_trace("Output %zu: %s", i, status_debug("Output %zu: %s", i,
tal_hex(tmpctx, bitcoin_tx_output_get_script( tal_hex(tmpctx, bitcoin_tx_output_get_script(
tmpctx, tx, i))); tmpctx, tx, i)));
} }
@ -2234,7 +2234,7 @@ static void handle_their_unilateral(const struct bitcoin_tx *tx,
*/ */
resolved_by_other(outs[0], txid, THEIR_UNILATERAL); resolved_by_other(outs[0], txid, THEIR_UNILATERAL);
status_trace("Deriving keyset %"PRIu64 status_debug("Deriving keyset %"PRIu64
": per_commit_point=%s" ": per_commit_point=%s"
" self_payment_basepoint=%s" " self_payment_basepoint=%s"
" other_payment_basepoint=%s" " other_payment_basepoint=%s"
@ -2267,7 +2267,7 @@ static void handle_their_unilateral(const struct bitcoin_tx *tx,
status_failed(STATUS_FAIL_INTERNAL_ERROR, status_failed(STATUS_FAIL_INTERNAL_ERROR,
"Deriving keyset for %"PRIu64, commit_num); "Deriving keyset for %"PRIu64, commit_num);
status_trace("Deconstructing unilateral tx: %"PRIu64 status_debug("Deconstructing unilateral tx: %"PRIu64
" using keyset: " " using keyset: "
" self_revocation_key: %s" " self_revocation_key: %s"
" self_delayed_payment_key: %s" " self_delayed_payment_key: %s"
@ -2300,15 +2300,15 @@ static void handle_their_unilateral(const struct bitcoin_tx *tx,
/* Calculate all the HTLC scripts so we can match them */ /* Calculate all the HTLC scripts so we can match them */
htlc_scripts = derive_htlc_scripts(htlcs, REMOTE); htlc_scripts = derive_htlc_scripts(htlcs, REMOTE);
status_trace("Script to-them: %u: %s (%s)", status_debug("Script to-them: %u: %s (%s)",
to_self_delay[REMOTE], to_self_delay[REMOTE],
tal_hex(tmpctx, script[REMOTE]), tal_hex(tmpctx, script[REMOTE]),
tal_hex(tmpctx, remote_wscript)); tal_hex(tmpctx, remote_wscript));
status_trace("Script to-me: %s", status_debug("Script to-me: %s",
tal_hex(tmpctx, script[LOCAL])); tal_hex(tmpctx, script[LOCAL]));
for (i = 0; i < tx->wtx->num_outputs; i++) { for (i = 0; i < tx->wtx->num_outputs; i++) {
status_trace("Output %zu: %s", i, status_debug("Output %zu: %s", i,
tal_hex(tmpctx, bitcoin_tx_output_get_script( tal_hex(tmpctx, bitcoin_tx_output_get_script(
tmpctx, tx, i))); tmpctx, tx, i)));
} }
@ -2573,7 +2573,7 @@ int main(int argc, char *argv[])
tx->chainparams = chainparams_by_chainhash(&chain_hash); tx->chainparams = chainparams_by_chainhash(&chain_hash);
status_trace("feerate_per_kw = %u", feerate_per_kw); status_debug("feerate_per_kw = %u", feerate_per_kw);
bitcoin_txid(tx, &txid); bitcoin_txid(tx, &txid);
/* We need to keep tx around, but there's only one: not really a leak */ /* We need to keep tx around, but there's only one: not really a leak */
tal_steal(ctx, notleak(tx)); tal_steal(ctx, notleak(tx));
@ -2603,10 +2603,10 @@ int main(int argc, char *argv[])
funding, funding,
FUNDING_OUTPUT, NULL, NULL, NULL); FUNDING_OUTPUT, NULL, NULL, NULL);
status_trace("Remote per-commit point: %s", status_debug("Remote per-commit point: %s",
type_to_string(tmpctx, struct pubkey, type_to_string(tmpctx, struct pubkey,
&remote_per_commit_point)); &remote_per_commit_point));
status_trace("Old remote per-commit point: %s", status_debug("Old remote per-commit point: %s",
type_to_string(tmpctx, struct pubkey, type_to_string(tmpctx, struct pubkey,
&old_remote_per_commit_point)); &old_remote_per_commit_point));
@ -2635,7 +2635,7 @@ int main(int argc, char *argv[])
&basepoints[LOCAL].payment, &basepoints[LOCAL].payment,
&basepoints[REMOTE].payment); &basepoints[REMOTE].payment);
status_trace("commitnum = %"PRIu64 status_debug("commitnum = %"PRIu64
", revocations_received = %"PRIu64, ", revocations_received = %"PRIu64,
commit_num, revocations_received(&shachain)); commit_num, revocations_received(&shachain));
@ -2672,7 +2672,7 @@ int main(int argc, char *argv[])
* local node is required to handle both. * local node is required to handle both.
*/ */
} else if (commit_num == revocations_received(&shachain)) { } else if (commit_num == revocations_received(&shachain)) {
status_trace("Their unilateral tx, old commit point"); status_debug("Their unilateral tx, old commit point");
handle_their_unilateral(tx, tx_blockheight, handle_their_unilateral(tx, tx_blockheight,
&txid, &txid,
&old_remote_per_commit_point, &old_remote_per_commit_point,
@ -2682,7 +2682,7 @@ int main(int argc, char *argv[])
tell_immediately, tell_immediately,
outs); outs);
} else if (commit_num == revocations_received(&shachain) + 1) { } else if (commit_num == revocations_received(&shachain) + 1) {
status_trace("Their unilateral tx, new commit point"); status_debug("Their unilateral tx, new commit point");
handle_their_unilateral(tx, tx_blockheight, handle_their_unilateral(tx, tx_blockheight,
&txid, &txid,
&remote_per_commit_point, &remote_per_commit_point,

4
onchaind/test/run-grind_feerate.c

@ -2,8 +2,8 @@
#include <ccan/time/time.h> #include <ccan/time/time.h>
#include <common/status.h> #include <common/status.h>
#undef status_trace #undef status_debug
#define status_trace(...) #define status_debug(...)
#define main unused_main #define main unused_main
int main(int argc, char *argv[]); int main(int argc, char *argv[]);

8
openingd/openingd.c

@ -435,7 +435,7 @@ static u8 *opening_negotiate_msg(const tal_t *ctx, struct state *state,
* probably be best with another daemon to de-multiplex them; * probably be best with another daemon to de-multiplex them;
* this could be connectd itself, in fact. */ * this could be connectd itself, in fact. */
if (is_wrong_channel(msg, &state->channel_id, &actual)) { if (is_wrong_channel(msg, &state->channel_id, &actual)) {
status_trace("Rejecting %s for unknown channel_id %s", status_debug("Rejecting %s for unknown channel_id %s",
wire_type_name(fromwire_peektype(msg)), wire_type_name(fromwire_peektype(msg)),
type_to_string(tmpctx, struct channel_id, type_to_string(tmpctx, struct channel_id,
&actual)); &actual));
@ -708,7 +708,7 @@ static bool funder_finalize_channel_setup(struct state *state,
/* You can tell this has been a problem before, since there's a debug /* You can tell this has been a problem before, since there's a debug
* message here: */ * message here: */
status_trace("signature %s on tx %s using key %s", status_debug("signature %s on tx %s using key %s",
type_to_string(tmpctx, struct bitcoin_signature, sig), type_to_string(tmpctx, struct bitcoin_signature, sig),
type_to_string(tmpctx, struct bitcoin_tx, *tx), type_to_string(tmpctx, struct bitcoin_tx, *tx),
type_to_string(tmpctx, struct pubkey, type_to_string(tmpctx, struct pubkey,
@ -1746,7 +1746,7 @@ int main(int argc, char *argv[])
assert(none == NULL); assert(none == NULL);
/*~ Turns out this is useful for testing, to make sure we're ready. */ /*~ Turns out this is useful for testing, to make sure we're ready. */
status_trace("Handed peer, entering loop"); status_debug("Handed peer, entering loop");
/*~ We manually run a little poll() loop here. With only three fds */ /*~ We manually run a little poll() loop here. With only three fds */
pollfd[0].fd = REQ_FD; pollfd[0].fd = REQ_FD;
@ -1790,7 +1790,7 @@ int main(int argc, char *argv[])
* read yet, it will simply be read by the next daemon. */ * read yet, it will simply be read by the next daemon. */
wire_sync_write(REQ_FD, msg); wire_sync_write(REQ_FD, msg);
per_peer_state_fdpass_send(REQ_FD, state->pps); per_peer_state_fdpass_send(REQ_FD, state->pps);
status_trace("Sent %s with fds", status_debug("Sent %s with fds",
opening_wire_type_name(fromwire_peektype(msg))); opening_wire_type_name(fromwire_peektype(msg)));
/* This frees the entire tal tree. */ /* This frees the entire tal tree. */

Loading…
Cancel
Save