Do these two ranges overlap? If so, return that range. */
| 441 | |
| 442 | /* Do these two ranges overlap? If so, return that range. */ |
| 443 | static 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? */ |
| 461 | static bool amount_in_range(struct amount_sat amount, |
no test coverage detected