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

Function send_offer

closingd/closingd.c:130–216  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

128}
129
130static void send_offer(struct per_peer_state *pps,
131 const struct chainparams *chainparams,
132 const struct channel_id *channel_id,
133 const struct pubkey *funding_pubkey,
134 const u8 *funding_wscript,
135 u32 *local_wallet_index,
136 const struct ext_key *local_wallet_ext_key,
137 u8 *scriptpubkey[NUM_SIDES],
138 const struct bitcoin_outpoint *funding,
139 struct amount_sat funding_sats,
140 const struct amount_sat out[NUM_SIDES],
141 enum side opener,
142 struct amount_sat our_dust_limit,
143 struct amount_sat fee_to_offer,
144 const struct bitcoin_outpoint *wrong_funding,
145 const struct tlv_closing_signed_tlvs_fee_range *tlv_fees,
146 struct amount_sat max_fee_to_accept)
147{
148 struct bitcoin_tx *tx;
149 struct bitcoin_signature our_sig;
150 struct tlv_closing_signed_tlvs *close_tlvs;
151 u8 *msg;
152
153 /* We can arrive here in multiple ways, so add a final sanity check
154 * that we did not go over our max fee */
155 if (amount_sat_greater(fee_to_offer, max_fee_to_accept))
156 peer_failed_warn(pps, channel_id, "Fee %s became larger than our"
157 " max fee %s",
158 fmt_amount_sat(tmpctx, fee_to_offer),
159 fmt_amount_sat(tmpctx, max_fee_to_accept));
160
161 /* BOLT #2:
162 *
163 * - MUST set `signature` to the Bitcoin signature of the close
164 * transaction, as specified in [BOLT
165 * #3](03-transactions.md#closing-transaction).
166 */
167 tx = close_tx(tmpctx, chainparams, pps, channel_id,
168 local_wallet_index,
169 local_wallet_ext_key,
170 scriptpubkey,
171 funding,
172 funding_sats,
173 funding_wscript,
174 out,
175 opener, fee_to_offer, our_dust_limit,
176 wrong_funding);
177
178 /* BOLT #3:
179 *
180 * Each node offering a signature:
181 * ...
182 * - MAY eliminate its own output.
183 */
184 /* (We don't do this). */
185 wire_sync_write(HSM_FD,
186 take(towire_hsmd_sign_mutual_close_tx(NULL,
187 tx,

Callers 2

do_quickcloseFunction · 0.85
mainFunction · 0.85

Calls 11

amount_sat_greaterFunction · 0.85
peer_failed_warnFunction · 0.85
close_txFunction · 0.85
tal_hexFunction · 0.85
peer_writeFunction · 0.85
notifyFunction · 0.70
fmt_amount_satFunction · 0.50
wire_sync_writeFunction · 0.50
wire_sync_readFunction · 0.50
status_failedFunction · 0.50

Tested by

no test coverage detected