Returns fee they offered. */
| 225 | |
| 226 | /* Returns fee they offered. */ |
| 227 | static struct amount_sat |
| 228 | receive_offer(struct per_peer_state *pps, |
| 229 | const struct chainparams *chainparams, |
| 230 | const struct channel_id *channel_id, |
| 231 | const struct pubkey *funding_pubkey, |
| 232 | const u8 *funding_wscript, |
| 233 | u32 *local_wallet_index, |
| 234 | const struct ext_key *local_wallet_ext_key, |
| 235 | u8 *scriptpubkey[NUM_SIDES], |
| 236 | const struct bitcoin_outpoint *funding, |
| 237 | struct amount_sat funding_sats, |
| 238 | const struct amount_sat out[NUM_SIDES], |
| 239 | enum side opener, |
| 240 | struct amount_sat our_dust_limit, |
| 241 | struct amount_sat min_fee_to_accept, |
| 242 | const struct bitcoin_outpoint *wrong_funding, |
| 243 | struct bitcoin_txid *closing_txid, |
| 244 | struct tlv_closing_signed_tlvs_fee_range **tlv_fees) |
| 245 | { |
| 246 | u8 *msg; |
| 247 | struct channel_id their_channel_id; |
| 248 | struct amount_sat received_fee; |
| 249 | struct bitcoin_signature their_sig; |
| 250 | struct bitcoin_tx *tx; |
| 251 | struct tlv_closing_signed_tlvs *close_tlvs; |
| 252 | |
| 253 | /* Wait for them to say something interesting */ |
| 254 | do { |
| 255 | msg = closing_read_peer_msg(tmpctx, pps); |
| 256 | |
| 257 | /* BOLT #2: |
| 258 | * |
| 259 | * - upon reconnection: |
| 260 | * - MUST ignore any redundant `channel_ready` it receives. |
| 261 | */ |
| 262 | /* This should only happen if we've made no commitments, but |
| 263 | * we don't have to check that: it's their problem. */ |
| 264 | if (fromwire_peektype(msg) == WIRE_CHANNEL_READY) |
| 265 | msg = tal_free(msg); |
| 266 | /* BOLT #2: |
| 267 | * - if it has sent a previous `shutdown`: |
| 268 | * - MUST retransmit `shutdown`. |
| 269 | */ |
| 270 | else if (fromwire_peektype(msg) == WIRE_SHUTDOWN) |
| 271 | msg = tal_free(msg); |
| 272 | /* We can get announcement signatures: too late! */ |
| 273 | else if (fromwire_peektype(msg) == WIRE_ANNOUNCEMENT_SIGNATURES) |
| 274 | msg = tal_free(msg); |
| 275 | } while (!msg); |
| 276 | |
| 277 | their_sig.sighash_type = SIGHASH_ALL; |
| 278 | if (!fromwire_closing_signed(msg, msg, &their_channel_id, |
| 279 | &received_fee, &their_sig.s, |
| 280 | &close_tlvs)) |
| 281 | peer_failed_warn(pps, channel_id, |
| 282 | "Expected closing_signed: %s", |
| 283 | tal_hex(tmpctx, msg)); |
| 284 |
no test coverage detected