MCPcopy Create free account
hub / github.com/ElementsProject/lightning / fail_dangling_htlc_in

Function fail_dangling_htlc_in

lightningd/peer_htlcs.c:1573–1605  ·  view source on GitHub ↗

This case searches harder to see if there are any incoming HTLCs */

Source from the content-addressed store, hash-verified

1571
1572/* This case searches harder to see if there are any incoming HTLCs */
1573static void fail_dangling_htlc_in(struct lightningd *ld,
1574 const struct sha256 *payment_hash)
1575{
1576 struct htlc_in *hin;
1577 struct htlc_in_map_iter ini;
1578
1579 for (hin = htlc_in_map_first(&ld->htlcs_in, &ini);
1580 hin;
1581 hin = htlc_in_map_next(&ld->htlcs_in, &ini)) {
1582 if (!sha256_eq(&hin->payment_hash, payment_hash))
1583 continue;
1584 if (hin->badonion) {
1585 log_broken(hin->key.channel->log,
1586 "htlc %"PRIu64" already failed with badonion",
1587 hin->key.id);
1588 } else if (hin->preimage) {
1589 log_broken(hin->key.channel->log,
1590 "htlc %"PRIu64" already succeeded with preimage",
1591 hin->key.id);
1592 } else if (hin->failonion) {
1593 log_broken(hin->key.channel->log,
1594 "htlc %"PRIu64" already failed with failonion %s",
1595 hin->key.id,
1596 tal_hex(tmpctx, hin->failonion->contents));
1597 } else {
1598 log_broken(hin->key.channel->log,
1599 "htlc %"PRIu64" has matching hash: failing",
1600 hin->key.id);
1601 local_fail_in_htlc(hin,
1602 take(towire_permanent_channel_failure(NULL)));
1603 }
1604 }
1605}
1606
1607void onchain_failed_our_htlc(const struct channel *channel,
1608 const struct htlc_stub *htlc,

Callers 1

onchain_failed_our_htlcFunction · 0.85

Calls 3

tal_hexFunction · 0.85
local_fail_in_htlcFunction · 0.85

Tested by

no test coverage detected