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

Function htlcs_resubmit

lightningd/peer_htlcs.c:2742–2772  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2740#endif /* COMPAT_V061 */
2741
2742void htlcs_resubmit(struct lightningd *ld,
2743 struct htlc_in_map *unconnected_htlcs_in)
2744{
2745 struct htlc_in *hin;
2746 struct htlc_in_map_iter ini;
2747 enum onion_wire badonion COMPILER_WANTS_INIT("gcc7.4.0 bad, 8.3 OK");
2748 u8 *failmsg;
2749
2750 /* Now retry any which were stuck. */
2751 for (hin = htlc_in_map_first(unconnected_htlcs_in, &ini);
2752 hin;
2753 hin = htlc_in_map_next(unconnected_htlcs_in, &ini)) {
2754 if (hin->hstate != RCVD_ADD_ACK_REVOCATION)
2755 continue;
2756
2757 log_unusual(hin->key.channel->log,
2758 "Replaying old unprocessed HTLC #%"PRIu64,
2759 hin->key.id);
2760 if (!peer_accepted_htlc(tmpctx, hin->key.channel, hin->key.id,
2761 true, &badonion, &failmsg)) {
2762 if (failmsg)
2763 local_fail_in_htlc(hin, failmsg);
2764 else
2765 local_fail_in_htlc_badonion(hin, badonion);
2766 }
2767 }
2768
2769 /* Don't leak memory! */
2770 htlc_in_map_clear(unconnected_htlcs_in);
2771 tal_free(unconnected_htlcs_in);
2772}
2773
2774#if DEVELOPER
2775static struct command_result *json_dev_ignore_htlcs(struct command *cmd,

Callers 2

mainFunction · 0.70
test_htlc_crudFunction · 0.50

Calls 4

peer_accepted_htlcFunction · 0.85
local_fail_in_htlcFunction · 0.85
tal_freeFunction · 0.85

Tested by 1

test_htlc_crudFunction · 0.40