Skip to content

Commit

Permalink
lightningd: more debugging around fake_channeld failure.
Browse files Browse the repository at this point in the history
```
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 <[email protected]>
  • Loading branch information
rustyrussell committed Dec 18, 2024
1 parent fe69ee1 commit a5c0c43
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion lightningd/peer_htlcs.c
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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) {
Expand Down

0 comments on commit a5c0c43

Please sign in to comment.