| 130 | } |
| 131 | |
| 132 | static void send_offer(struct per_peer_state *pps, |
| 133 | const struct chainparams *chainparams, |
| 134 | const struct channel_id *channel_id, |
| 135 | const struct pubkey funding_pubkey[NUM_SIDES], |
| 136 | const u8 *funding_wscript, |
| 137 | u32 *local_wallet_index, |
| 138 | const struct ext_key *local_wallet_ext_key, |
| 139 | u8 *scriptpubkey[NUM_SIDES], |
| 140 | const struct bitcoin_outpoint *funding, |
| 141 | struct amount_sat funding_sats, |
| 142 | const struct amount_sat out[NUM_SIDES], |
| 143 | enum side opener, |
| 144 | struct amount_sat our_dust_limit, |
| 145 | struct amount_sat fee_to_offer, |
| 146 | const struct bitcoin_outpoint *wrong_funding, |
| 147 | const struct tlv_closing_signed_tlvs_fee_range *tlv_fees) |
| 148 | { |
| 149 | struct bitcoin_tx *tx; |
| 150 | struct bitcoin_signature our_sig; |
| 151 | struct tlv_closing_signed_tlvs *close_tlvs; |
| 152 | u8 *msg; |
| 153 | |
| 154 | /* BOLT #2: |
| 155 | * |
| 156 | * - MUST set `signature` to the Bitcoin signature of the close |
| 157 | * transaction, as specified in [BOLT |
| 158 | * #3](03-transactions.md#closing-transaction). |
| 159 | */ |
| 160 | tx = close_tx(tmpctx, chainparams, pps, channel_id, |
| 161 | local_wallet_index, |
| 162 | local_wallet_ext_key, |
| 163 | scriptpubkey, |
| 164 | funding, |
| 165 | funding_sats, |
| 166 | funding_wscript, |
| 167 | out, |
| 168 | opener, fee_to_offer, our_dust_limit, |
| 169 | wrong_funding); |
| 170 | |
| 171 | /* BOLT #3: |
| 172 | * |
| 173 | * ## Closing Transaction |
| 174 | *... |
| 175 | * Each node offering a signature... MAY eliminate its |
| 176 | * own output. |
| 177 | */ |
| 178 | /* (We don't do this). */ |
| 179 | wire_sync_write(HSM_FD, |
| 180 | take(towire_hsmd_sign_mutual_close_tx(NULL, |
| 181 | tx, |
| 182 | &funding_pubkey[REMOTE]))); |
| 183 | msg = wire_sync_read(tmpctx, HSM_FD); |
| 184 | if (!fromwire_hsmd_sign_tx_reply(msg, &our_sig)) |
| 185 | status_failed(STATUS_FAIL_HSM_IO, |
| 186 | "Bad hsm_sign_mutual_close_tx reply %s", |
| 187 | tal_hex(tmpctx, msg)); |
| 188 | |
| 189 | status_debug("sending fee offer %s", |
no test coverage detected