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

Function get_overlap

closingd/closingd.c:443–458  ·  view source on GitHub ↗

Do these two ranges overlap? If so, return that range. */

Source from the content-addressed store, hash-verified

441
442/* Do these two ranges overlap? If so, return that range. */
443static bool get_overlap(const struct tlv_closing_signed_tlvs_fee_range *r1,
444 const struct tlv_closing_signed_tlvs_fee_range *r2,
445 struct tlv_closing_signed_tlvs_fee_range *overlap)
446{
447 if (amount_sat_greater(r1->min_fee_satoshis, r2->min_fee_satoshis))
448 overlap->min_fee_satoshis = r1->min_fee_satoshis;
449 else
450 overlap->min_fee_satoshis = r2->min_fee_satoshis;
451 if (amount_sat_less(r1->max_fee_satoshis, r2->max_fee_satoshis))
452 overlap->max_fee_satoshis = r1->max_fee_satoshis;
453 else
454 overlap->max_fee_satoshis = r2->max_fee_satoshis;
455
456 return amount_sat_less_eq(overlap->min_fee_satoshis,
457 overlap->max_fee_satoshis);
458}
459
460/* Is this amount in this range? */
461static bool amount_in_range(struct amount_sat amount,

Callers 1

do_quickcloseFunction · 0.85

Calls 3

amount_sat_greaterFunction · 0.85
amount_sat_lessFunction · 0.85
amount_sat_less_eqFunction · 0.85

Tested by

no test coverage detected