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

Function new_htlc_set

lightningd/htlc_set.c:108–134  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

106}
107
108static struct htlc_set *new_htlc_set(struct lightningd *ld,
109 struct incoming_payment *inpay,
110 const struct sha256 *payment_hash,
111 struct amount_msat total_msat)
112{
113 struct htlc_set *set;
114
115 set = tal(ld, struct htlc_set);
116 set->ld = ld;
117 set->total_msat = total_msat;
118 set->payment_hash = *payment_hash;
119 set->so_far = AMOUNT_MSAT(0);
120 set->inpays = tal_arr(set, struct incoming_payment *, 1);
121 set->inpays[0] = inpay;
122
123 /* BOLT #4:
124 * - MUST fail all HTLCs in the HTLC set after some reasonable
125 * timeout.
126 * - SHOULD wait for at least 60 seconds after the initial
127 * HTLC.
128 */
129 set->timeout = new_reltimer(ld->timers, set, time_from_sec(70),
130 timeout_htlc_set, set);
131 htlc_set_map_add(ld->htlc_sets, set);
132 tal_add_destructor2(set, destroy_htlc_set, ld->htlc_sets);
133 return set;
134}
135
136void htlc_set_add_(struct lightningd *ld,
137 struct logger *log,

Callers 1

htlc_set_add_Function · 0.85

Calls 1

time_from_secFunction · 0.85

Tested by

no test coverage detected