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

Function send_offer

closingd/closingd.c:130–207  ·  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{
147 struct bitcoin_tx *tx;
148 struct bitcoin_signature our_sig;
149 struct tlv_closing_signed_tlvs *close_tlvs;
150 u8 *msg;
151
152 /* BOLT #2:
153 *
154 * - MUST set `signature` to the Bitcoin signature of the close
155 * transaction, as specified in [BOLT
156 * #3](03-transactions.md#closing-transaction).
157 */
158 tx = close_tx(tmpctx, chainparams, pps, channel_id,
159 local_wallet_index,
160 local_wallet_ext_key,
161 scriptpubkey,
162 funding,
163 funding_sats,
164 funding_wscript,
165 out,
166 opener, fee_to_offer, our_dust_limit,
167 wrong_funding);
168
169 /* BOLT #3:
170 *
171 * Each node offering a signature:
172 * ...
173 * - MAY eliminate its own output.
174 */
175 /* (We don't do this). */
176 wire_sync_write(HSM_FD,
177 take(towire_hsmd_sign_mutual_close_tx(NULL,
178 tx,
179 &funding_pubkey[REMOTE])));
180 msg = wire_sync_read(tmpctx, HSM_FD);
181 if (!fromwire_hsmd_sign_tx_reply(msg, &our_sig))
182 status_failed(STATUS_FAIL_HSM_IO,
183 "Bad hsm_sign_mutual_close_tx reply %s",
184 tal_hex(tmpctx, msg));
185
186 status_debug("sending fee offer %s",
187 fmt_amount_sat(tmpctx, fee_to_offer));

Callers 2

do_quickcloseFunction · 0.85
mainFunction · 0.85

Calls 9

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

Tested by

no test coverage detected