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

Function do_quickclose

closingd/closingd.c:684–857  ·  view source on GitHub ↗

We've received one offer; if we're opener, that means we've already sent one * too. */

Source from the content-addressed store, hash-verified

682/* We've received one offer; if we're opener, that means we've already sent one
683 * too. */
684static void do_quickclose(struct amount_sat offer[NUM_SIDES],
685 struct per_peer_state *pps,
686 const struct channel_id *channel_id,
687 const struct pubkey funding_pubkey[NUM_SIDES],
688 const u8 *funding_wscript,
689 u32 *local_wallet_index,
690 const struct ext_key *local_wallet_ext_key,
691 u8 *scriptpubkey[NUM_SIDES],
692 const struct bitcoin_outpoint *funding,
693 struct amount_sat funding_sats,
694 const struct amount_sat out[NUM_SIDES],
695 enum side opener,
696 struct amount_sat our_dust_limit,
697 const struct bitcoin_outpoint *wrong_funding,
698 struct bitcoin_txid *closing_txid,
699 const struct tlv_closing_signed_tlvs_fee_range *our_feerange,
700 const struct tlv_closing_signed_tlvs_fee_range *their_feerange)
701{
702 struct tlv_closing_signed_tlvs_fee_range overlap;
703
704
705 /* BOLT #2:
706 * - if the message contains a `fee_range`:
707 * - if there is no overlap between that and its own `fee_range`:
708 * - SHOULD send a warning
709 * - MUST fail the channel if it doesn't receive a satisfying `fee_range` after a reasonable amount of time
710 */
711 /* (Note we satisfy the "MUST fail" by our close command unilteraltimeout) */
712 if (!get_overlap(our_feerange, their_feerange, &overlap)) {
713 peer_failed_warn(pps, channel_id,
714 "Unable to agree on a feerate."
715 " Our range %s-%s, other range %s-%s",
716 type_to_string(tmpctx,
717 struct amount_sat,
718 &our_feerange->min_fee_satoshis),
719 type_to_string(tmpctx,
720 struct amount_sat,
721 &our_feerange->max_fee_satoshis),
722 type_to_string(tmpctx,
723 struct amount_sat,
724 &their_feerange->min_fee_satoshis),
725 type_to_string(tmpctx,
726 struct amount_sat,
727 &their_feerange->max_fee_satoshis));
728 return;
729 }
730
731 status_info("performing quickclose in range %s-%s",
732 type_to_string(tmpctx, struct amount_sat,
733 &overlap.min_fee_satoshis),
734 type_to_string(tmpctx, struct amount_sat,
735 &overlap.max_fee_satoshis));
736
737 /* BOLT #2:
738 * - otherwise:
739 * - if it is the funder:
740 * - if `fee_satoshis` is not in the overlap between the sent
741 * and received `fee_range`:

Callers 1

mainFunction · 0.85

Calls 10

get_overlapFunction · 0.85
peer_failed_warnFunction · 0.85
amount_in_rangeFunction · 0.85
send_offerFunction · 0.85
amount_sat_greaterFunction · 0.85
amount_sat_lessFunction · 0.85
receive_offerFunction · 0.85
type_to_stringClass · 0.50
amount_sat_eqFunction · 0.50
peer_billboardFunction · 0.50

Tested by

no test coverage detected