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

Function get_overlap

closingd/closingd.c:448–463  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

446
447/* Do these two ranges overlap? If so, return that range. */
448static bool get_overlap(const struct tlv_closing_signed_tlvs_fee_range *r1,
449 const struct tlv_closing_signed_tlvs_fee_range *r2,
450 struct tlv_closing_signed_tlvs_fee_range *overlap)
451{
452 if (amount_sat_greater(r1->min_fee_satoshis, r2->min_fee_satoshis))
453 overlap->min_fee_satoshis = r1->min_fee_satoshis;
454 else
455 overlap->min_fee_satoshis = r2->min_fee_satoshis;
456 if (amount_sat_less(r1->max_fee_satoshis, r2->max_fee_satoshis))
457 overlap->max_fee_satoshis = r1->max_fee_satoshis;
458 else
459 overlap->max_fee_satoshis = r2->max_fee_satoshis;
460
461 return amount_sat_less_eq(overlap->min_fee_satoshis,
462 overlap->max_fee_satoshis);
463}
464
465/* Is this amount in this range? */
466static 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