From de65369e281b69496bfc55873c6f774716b59f08 Mon Sep 17 00:00:00 2001 From: Rusty Russell Date: Tue, 5 Nov 2019 03:23:48 +1030 Subject: [PATCH] channeld: if we can't restore HTLCs, log at level broken, not debug. Signed-off-by: Rusty Russell --- channeld/full_channel.c | 29 +++++++++++++++-------------- 1 file changed, 15 insertions(+), 14 deletions(-) diff --git a/channeld/full_channel.c b/channeld/full_channel.c index 94bb0a7c4..3963e61bc 100644 --- a/channeld/full_channel.c +++ b/channeld/full_channel.c @@ -1178,22 +1178,23 @@ bool channel_force_htlcs(struct channel *channel, struct htlc_map_iter it; if (tal_count(hstates) != tal_count(htlcs)) { - status_debug("#hstates %zu != #htlcs %zu", + status_broken("#hstates %zu != #htlcs %zu", tal_count(hstates), tal_count(htlcs)); return false; } if (tal_count(fulfilled) != tal_count(fulfilled_sides)) { - status_debug("#fulfilled sides %zu != #fulfilled %zu", + status_broken("#fulfilled sides %zu != #fulfilled %zu", tal_count(fulfilled_sides), tal_count(fulfilled)); return false; } if (tal_count(failed) != tal_count(failed_sides)) { - status_debug("#failed sides %zu != #failed %zu", + status_broken("#failed sides %zu != #failed %zu", tal_count(failed_sides), tal_count(failed)); return false; } + for (i = 0; i < tal_count(htlcs); i++) { enum channel_add_err e; struct htlc *htlc; @@ -1215,7 +1216,7 @@ bool channel_force_htlcs(struct channel *channel, &htlcs[i].payment_hash, htlcs[i].onion_routing_packet, &htlc, false, NULL); if (e != CHANNEL_ERR_ADD_OK) { - status_debug("%s HTLC %"PRIu64" failed error %u", + status_broken("%s HTLC %"PRIu64" failed error %u", htlc_state_owner(hstates[i]) == LOCAL ? "out" : "in", htlcs[i].id, e); return false; @@ -1227,31 +1228,31 @@ bool channel_force_htlcs(struct channel *channel, fulfilled_sides[i], fulfilled[i].id); if (!htlc) { - status_debug("Fulfill %s HTLC %"PRIu64" not found", + status_broken("Fulfill %s HTLC %"PRIu64" not found", fulfilled_sides[i] == LOCAL ? "out" : "in", fulfilled[i].id); return false; } if (htlc->r) { - status_debug("Fulfill %s HTLC %"PRIu64" already fulfilled", + status_broken("Fulfill %s HTLC %"PRIu64" already fulfilled", fulfilled_sides[i] == LOCAL ? "out" : "in", fulfilled[i].id); return false; } if (htlc->fail) { - status_debug("Fulfill %s HTLC %"PRIu64" already failed", + status_broken("Fulfill %s HTLC %"PRIu64" already failed", fulfilled_sides[i] == LOCAL ? "out" : "in", fulfilled[i].id); return false; } if (htlc->failcode) { - status_debug("Fulfill %s HTLC %"PRIu64" already fail %u", + status_broken("Fulfill %s HTLC %"PRIu64" already fail %u", fulfilled_sides[i] == LOCAL ? "out" : "in", fulfilled[i].id, htlc->failcode); return false; } if (!htlc_has(htlc, HTLC_REMOVING)) { - status_debug("Fulfill %s HTLC %"PRIu64" state %s", + status_broken("Fulfill %s HTLC %"PRIu64" state %s", fulfilled_sides[i] == LOCAL ? "out" : "in", fulfilled[i].id, htlc_state_name(htlc->state)); @@ -1266,31 +1267,31 @@ bool channel_force_htlcs(struct channel *channel, htlc = channel_get_htlc(channel, failed_sides[i], failed[i]->id); if (!htlc) { - status_debug("Fail %s HTLC %"PRIu64" not found", + status_broken("Fail %s HTLC %"PRIu64" not found", failed_sides[i] == LOCAL ? "out" : "in", failed[i]->id); return false; } if (htlc->r) { - status_debug("Fail %s HTLC %"PRIu64" already fulfilled", + status_broken("Fail %s HTLC %"PRIu64" already fulfilled", failed_sides[i] == LOCAL ? "out" : "in", failed[i]->id); return false; } if (htlc->fail) { - status_debug("Fail %s HTLC %"PRIu64" already failed", + status_broken("Fail %s HTLC %"PRIu64" already failed", failed_sides[i] == LOCAL ? "out" : "in", failed[i]->id); return false; } if (htlc->failcode) { - status_debug("Fail %s HTLC %"PRIu64" already fail %u", + status_broken("Fail %s HTLC %"PRIu64" already fail %u", failed_sides[i] == LOCAL ? "out" : "in", failed[i]->id, htlc->failcode); return false; } if (!htlc_has(htlc, HTLC_REMOVING)) { - status_debug("Fail %s HTLC %"PRIu64" state %s", + status_broken("Fail %s HTLC %"PRIu64" state %s", failed_sides[i] == LOCAL ? "out" : "in", fulfilled[i].id, htlc_state_name(htlc->state));