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

Function get_overlap

closingd/closingd.c:466–481  ·  view source on GitHub ↗

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

Source from the content-addressed store, hash-verified

464
465/* Do these two ranges overlap? If so, return that range. */
466static bool get_overlap(const struct tlv_closing_signed_tlvs_fee_range *r1,
467 const struct tlv_closing_signed_tlvs_fee_range *r2,
468 struct tlv_closing_signed_tlvs_fee_range *overlap)
469{
470 if (amount_sat_greater(r1->min_fee_satoshis, r2->min_fee_satoshis))
471 overlap->min_fee_satoshis = r1->min_fee_satoshis;
472 else
473 overlap->min_fee_satoshis = r2->min_fee_satoshis;
474 if (amount_sat_less(r1->max_fee_satoshis, r2->max_fee_satoshis))
475 overlap->max_fee_satoshis = r1->max_fee_satoshis;
476 else
477 overlap->max_fee_satoshis = r2->max_fee_satoshis;
478
479 return amount_sat_less_eq(overlap->min_fee_satoshis,
480 overlap->max_fee_satoshis);
481}
482
483/* Is this amount in this range? */
484static 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