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

Function check_cltv

lightningd/peer_htlcs.c:374–383  ·  view source on GitHub ↗

BOLT #4: * * - if it is not the final node: * - MUST return an error if: * ... * - `cltv_expiry` - `cltv_expiry_delta` < `outgoing_cltv_value` * - If it is the final node: *... * - MUST return an error if: *... * - incoming `cltv_expiry` < `outgoing_cltv_value`. */

Source from the content-addressed store, hash-verified

372 * - incoming `cltv_expiry` < `outgoing_cltv_value`.
373 */
374static bool check_cltv(struct htlc_in *hin,
375 u32 cltv_expiry, u32 outgoing_cltv_value, u32 delta)
376{
377 if (delta < cltv_expiry && cltv_expiry - delta >= outgoing_cltv_value)
378 return true;
379 log_debug(hin->key.channel->log, "HTLC %"PRIu64" incorrect CLTV:"
380 " %u in, %u out, delta reqd %u",
381 hin->key.id, cltv_expiry, outgoing_cltv_value, delta);
382 return false;
383}
384
385void fulfill_htlc(struct htlc_in *hin, const struct preimage *preimage)
386{

Callers 2

handle_localpayFunction · 0.85
forward_htlcFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected