We've received one offer; if we're opener, that means we've already sent one * too. */
| 657 | /* We've received one offer; if we're opener, that means we've already sent one |
| 658 | * too. */ |
| 659 | static void do_quickclose(struct amount_sat offer[NUM_SIDES], |
| 660 | struct per_peer_state *pps, |
| 661 | const struct channel_id *channel_id, |
| 662 | const struct pubkey funding_pubkey[NUM_SIDES], |
| 663 | const u8 *funding_wscript, |
| 664 | u32 *local_wallet_index, |
| 665 | const struct ext_key *local_wallet_ext_key, |
| 666 | u8 *scriptpubkey[NUM_SIDES], |
| 667 | const struct bitcoin_outpoint *funding, |
| 668 | struct amount_sat funding_sats, |
| 669 | const struct amount_sat out[NUM_SIDES], |
| 670 | enum side opener, |
| 671 | struct amount_sat our_dust_limit, |
| 672 | const struct bitcoin_outpoint *wrong_funding, |
| 673 | struct bitcoin_txid *closing_txid, |
| 674 | const struct tlv_closing_signed_tlvs_fee_range *our_feerange, |
| 675 | const struct tlv_closing_signed_tlvs_fee_range *their_feerange) |
| 676 | { |
| 677 | struct tlv_closing_signed_tlvs_fee_range overlap; |
| 678 | |
| 679 | |
| 680 | /* BOLT #2: |
| 681 | * - if the message contains a `fee_range`: |
| 682 | * - if there is no overlap between that and its own `fee_range`: |
| 683 | * - SHOULD send a warning |
| 684 | * - MUST fail the channel if it doesn't receive a satisfying `fee_range` after a reasonable amount of time |
| 685 | */ |
| 686 | /* (Note we satisfy the "MUST fail" by our close command unilteraltimeout) */ |
| 687 | if (!get_overlap(our_feerange, their_feerange, &overlap)) { |
| 688 | peer_failed_warn(pps, channel_id, |
| 689 | "Unable to agree on a feerate." |
| 690 | " Our range %s-%s, other range %s-%s", |
| 691 | fmt_amount_sat(tmpctx, our_feerange->min_fee_satoshis), |
| 692 | fmt_amount_sat(tmpctx, our_feerange->max_fee_satoshis), |
| 693 | fmt_amount_sat(tmpctx, their_feerange->min_fee_satoshis), |
| 694 | fmt_amount_sat(tmpctx, their_feerange->max_fee_satoshis)); |
| 695 | return; |
| 696 | } |
| 697 | |
| 698 | status_info("performing quickclose in range %s-%s", |
| 699 | fmt_amount_sat(tmpctx, overlap.min_fee_satoshis), |
| 700 | fmt_amount_sat(tmpctx, overlap.max_fee_satoshis)); |
| 701 | |
| 702 | /* BOLT #2: |
| 703 | * - otherwise: |
| 704 | * - if it is the funder: |
| 705 | * - if `fee_satoshis` is not in the overlap between the sent |
| 706 | * and received `fee_range`: |
| 707 | * - MUST fail the channel |
| 708 | * - otherwise: |
| 709 | * - MUST reply with the same `fee_satoshis`. |
| 710 | */ |
| 711 | if (opener == LOCAL) { |
| 712 | if (!amount_in_range(offer[REMOTE], &overlap)) { |
| 713 | peer_failed_warn(pps, channel_id, |
| 714 | "Your fee %s was not in range:" |
| 715 | " Our range %s-%s, other range %s-%s", |
| 716 | fmt_amount_sat(tmpctx, offer[REMOTE]), |
no test coverage detected