This case searches harder to see if there are any incoming HTLCs */
| 1571 | |
| 1572 | /* This case searches harder to see if there are any incoming HTLCs */ |
| 1573 | static 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 | |
| 1607 | void onchain_failed_our_htlc(const struct channel *channel, |
| 1608 | const struct htlc_stub *htlc, |
no test coverage detected