From a5c0c4359880471e8289801b6b3b996abd231419 Mon Sep 17 00:00:00 2001 From: Rusty Russell Date: Wed, 18 Dec 2024 13:01:29 +1030 Subject: [PATCH] lightningd: more debugging around fake_channeld failure. ``` 2024-12-16T23:16:16.4874420Z lightningd-1 2024-12-16T22:45:14.068Z UNUSUAL 022d223620a359a47ff7f7ac447c85c46c923da53389221a0054c11c1e3ca31d59-channeld-chan#1: Adding HTLC 18446744073709551615 too slow: killing connection ``` This implies that we don't transition the HTLC correctly. Signed-off-by: Rusty Russell --- lightningd/peer_htlcs.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/lightningd/peer_htlcs.c b/lightningd/peer_htlcs.c index 8bfb9afa42f1..ba5cbed57a84 100644 --- a/lightningd/peer_htlcs.c +++ b/lightningd/peer_htlcs.c @@ -722,6 +722,7 @@ const u8 *send_htlc_out(const tal_t *ctx, *houtp, time_from_sec(30), htlc_offer_timeout, *houtp); + log_debug(out->log, "Added timer for htlc %p", *houtp); } msg = towire_channeld_offer_htlc(out, amount, cltv, payment_hash, @@ -2000,6 +2001,8 @@ static bool update_out_htlc(struct channel *channel, /* First transition into commitment; now it outlives peer. */ if (newstate == SENT_ADD_COMMIT) { + log_debug(channel->log, "Removing timer for htlc %p %"PRIu64" (dbid %"PRIu64")", + hout, hout->key.id, hout->dbid); tal_del_destructor(hout, destroy_hout_subd_died); hout->timeout = tal_free(hout->timeout); tal_steal(ld, hout); @@ -2109,13 +2112,17 @@ void peer_sending_commitsig(struct channel *channel, const u8 *msg) return; } + log_debug(channel->log, "sending_commitsig with %zu changes", + tal_count(changed_htlcs)); for (i = 0; i < tal_count(changed_htlcs); i++) { + log_debug(channel->log, ".. changed htlc %"PRIu64" -> %s", + changed_htlcs[i].id, htlc_state_name(changed_htlcs[i].newstate)); + if (!changed_htlc(channel, changed_htlcs + i)) { channel_internal_error(channel, "channel_sending_commitsig: update failed"); return; } - /* While we're here, sanity check added ones are in * ascending order. */ if (changed_htlcs[i].newstate == SENT_ADD_COMMIT) {