transition from status_trace() to status_debug

This commit is contained in:
darosior
2019-09-08 18:39:26 +02:00
committed by Rusty Russell
parent 0504a51211
commit 0b0ad4c22d
27 changed files with 210 additions and 213 deletions

View File

@@ -321,7 +321,7 @@ bool gossip_store_compact(struct gossip_store *gs)
if (gs->disable_compaction)
return false;
status_trace(
status_debug(
"Compacting gossip_store with %zu entries, %zu of which are stale",
gs->count, gs->deleted);
@@ -419,7 +419,7 @@ bool gossip_store_compact(struct gossip_store *gs)
" %s",
strerror(errno));
status_trace(
status_debug(
"Compaction completed: dropped %zu messages, new count %zu, len %"PRIu64,
deleted, count, len);
gs->count = count;
@@ -435,7 +435,7 @@ bool gossip_store_compact(struct gossip_store *gs)
unlink_disable:
unlink(GOSSIP_STORE_TEMP_FILENAME);
disable:
status_trace("Encountered an error while compacting, disabling "
status_debug("Encountered an error while compacting, disabling "
"future compactions.");
gs->disable_compaction = true;
return false;
@@ -734,9 +734,9 @@ corrupt:
contents_ok = false;
out:
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)));
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,
gs->len);

View File

@@ -335,12 +335,12 @@ static u8 *zencode(const tal_t *ctx, const u8 *scids, size_t len)
z = tal_arr(ctx, u8, compressed_len);
err = compress2(z, &compressed_len, scids, len, Z_DEFAULT_COMPRESSION);
if (err == Z_OK) {
status_trace("compressed %zu into %lu",
status_debug("compressed %zu into %lu",
len, compressed_len);
tal_resize(&z, compressed_len);
return z;
}
status_trace("compress %zu returned %i:"
status_debug("compress %zu returned %i:"
" not compresssing", len, err);
return NULL;
}
@@ -434,7 +434,7 @@ static void setup_gossip_range(struct peer *peer)
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),
peer->gossip_level == GOSSIP_HIGH ? "HIGH"
: 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_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),
tal_count(scids));
return true;
@@ -820,7 +820,7 @@ static const u8 *handle_query_short_channel_ids(struct peer *peer, const u8 *msg
#endif
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 bitcoin_blkid, &chain));
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
* with the `complete` flag unset */
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 bitcoin_blkid,
&chain_hash));
@@ -1848,7 +1848,7 @@ static bool handle_get_update(struct peer *peer, const u8 *msg)
update = gossip_store_get(tmpctx, rstate->gs,
chan->half[direction].bcast.index);
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 short_channel_id, &scid),
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. */
chan = get_channel(peer->daemon->rstate, &scid);
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 short_channel_id,
&scid));
@@ -2259,7 +2259,7 @@ static void gossip_send_keepalive_update(struct daemon *daemon,
const struct chan *chan,
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,
&chan->scid));
@@ -2505,7 +2505,7 @@ static struct io_plan *getroute_req(struct io_conn *conn, struct daemon *daemon,
&max_hops))
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
? type_to_string(tmpctx, struct node_id, source) : "(me)",
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");
queue_peer_msg(peer, take(ping));
status_trace("sending ping expecting %sresponse",
status_debug("sending ping expecting %sresponse",
num_pong_bytes >= 65532 ? "no " : "");
/* 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))
master_badmsg(WIRE_GOSSIP_GET_INCOMING_CHANNELS, msg);
status_trace("exposeprivate = %s",
status_debug("exposeprivate = %s",
exposeprivate ? (*exposeprivate ? "TRUE" : "FALSE") : "NULL");
status_trace("msg = %s", tal_hex(tmpctx, msg));
status_trace("always_expose = %u, never_expose = %u",
status_debug("msg = %s", tal_hex(tmpctx, msg));
status_debug("always_expose = %u, never_expose = %u",
always_expose(exposeprivate), never_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))
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);
}
@@ -3077,13 +3077,13 @@ static struct io_plan *get_channel_peer(struct io_conn *conn,
chan = get_channel(daemon->rstate, &scid);
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));
key = NULL;
} else if (local_direction(daemon, chan, &direction)) {
key = &chan->nodes[!direction]->id;
} 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,
&scid));
key = NULL;
@@ -3237,7 +3237,7 @@ static struct io_plan *handle_outpoint_spent(struct io_conn *conn,
chan = get_channel(rstate, &scid);
if (chan) {
status_trace(
status_debug(
"Deleting channel %s due to the funding outpoint being "
"spent",
type_to_string(msg, struct short_channel_id, &scid));

View File

@@ -411,7 +411,7 @@ static void init_half_chan(struct routing_state *rstate,
static void bad_gossip_order(const u8 *msg, const char *source,
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)),
details);
}
@@ -1592,7 +1592,7 @@ u8 *handle_channel_announcement(struct routing_state *rstate,
* or not.
*/
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));
goto ignored;
}
@@ -1605,7 +1605,7 @@ u8 *handle_channel_announcement(struct routing_state *rstate,
*/
if (!bitcoin_blkid_eq(&chain_hash,
&rstate->chainparams->genesis_blockhash)) {
status_trace(
status_debug(
"Received channel_announcement %s for unknown chain %s",
type_to_string(pending, struct short_channel_id,
&pending->short_channel_id),
@@ -1635,7 +1635,7 @@ u8 *handle_channel_announcement(struct routing_state *rstate,
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,
&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 */
err = handle_channel_update(rstate, cupdate, "pending update", NULL);
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),
sanitize_error(tmpctx, err, NULL));
tal_free(err);
@@ -1703,7 +1703,7 @@ bool handle_pending_cannouncement(struct routing_state *rstate,
* - MUST ignore the message.
*/
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,
scid));
tal_free(pending);
@@ -1726,7 +1726,7 @@ bool handle_pending_cannouncement(struct routing_state *rstate,
&pending->bitcoin_key_2));
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,
scid),
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->updates[direction]) {
status_trace("Replacing existing update");
status_debug("Replacing existing update");
tal_free(pending->updates[direction]);
}
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,
&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,
&chain_hash));
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 */
pending = find_pending_cannouncement(rstate, &short_channel_id);
if (pending) {
status_trace("Updated pending announce with update %s/%u",
status_debug("Updated pending announce with update %s/%u",
type_to_string(tmpctx,
struct short_channel_id,
&short_channel_id),
@@ -2087,7 +2087,7 @@ u8 *handle_channel_update(struct routing_state *rstate, const u8 *update TAKES,
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,
&short_channel_id),
channel_flags & 0x01,
@@ -2122,7 +2122,7 @@ struct wireaddr *read_addresses(const tal_t *ctx, const u8 *ser)
/* Parsing address failed */
return tal_free(wireaddrs);
/* Unknown type, stop there. */
status_trace("read_addresses: unknown address type %u",
status_debug("read_addresses: unknown address type %u",
cursor[0]);
break;
}
@@ -2158,7 +2158,7 @@ bool routing_add_node_announcement(struct routing_state *rstate,
/* Only log this if *not* loading from store. */
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));
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.
*/
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),
tal_hex(tmpctx, features));
return NULL;
@@ -2418,7 +2418,7 @@ void routing_failure(struct routing_state *rstate,
{
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, "
"channel %s/%u",
(int) failcode, onion_type_name(failcode),
@@ -2458,7 +2458,7 @@ void routing_failure(struct routing_state *rstate,
struct chan_map_iter i;
struct chan *c;
status_trace("Deleting node %s",
status_debug("Deleting node %s",
type_to_string(tmpctx,
struct node_id,
&node->id));
@@ -2484,7 +2484,7 @@ void routing_failure(struct routing_state *rstate,
erring_node_id))
return;
status_trace("Deleting channel %s",
status_debug("Deleting channel %s",
type_to_string(tmpctx,
struct short_channel_id,
scid));
@@ -2519,7 +2519,7 @@ void route_prune(struct routing_state *rstate)
|| chan->half[0].bcast.timestamp < highwater)
&& (!is_halfchan_defined(&chan->half[1])
|| chan->half[1].bcast.timestamp < highwater)) {
status_trace(
status_debug(
"Pruning channel %s from network view (ages %"PRIu64" and %"PRIu64"s)",
type_to_string(tmpctx, struct short_channel_id,
&chan->scid),
@@ -2567,11 +2567,11 @@ bool handle_local_add_channel(struct routing_state *rstate,
/* Can happen on channeld restart. */
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;
}
status_trace("local_add_channel %s",
status_debug("local_add_channel %s",
type_to_string(tmpctx, struct short_channel_id, &scid));
/* Create new (unannounced) channel */

View File

@@ -193,9 +193,9 @@ int main(void)
node_id_from_privkey(&tmp, &c);
new_node(rstate, &c);
status_trace("A = %s", type_to_string(tmpctx, struct node_id, &a));
status_trace("B = %s", type_to_string(tmpctx, struct node_id, &b));
status_trace("C = %s", type_to_string(tmpctx, struct node_id, &c));
status_debug("A = %s", type_to_string(tmpctx, struct node_id, &a));
status_debug("B = %s", type_to_string(tmpctx, struct node_id, &b));
status_debug("C = %s", type_to_string(tmpctx, struct node_id, &c));
add_connection(rstate, &b, &c, 1, 1, 1);
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));
node_id_from_privkey(&tmp, &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, &d, &c, 0, 2, 1);