| 1298 | } |
| 1299 | |
| 1300 | static void handle_tx_sigs(struct state *state, const u8 *msg) |
| 1301 | { |
| 1302 | struct channel_id cid; |
| 1303 | struct bitcoin_txid txid; |
| 1304 | const struct witness **witnesses; |
| 1305 | struct tx_state *tx_state = state->tx_state; |
| 1306 | |
| 1307 | struct tlv_txsigs_tlvs *txsig_tlvs = tlv_txsigs_tlvs_new(tmpctx); |
| 1308 | if (!fromwire_tx_signatures(tmpctx, msg, &cid, &txid, |
| 1309 | cast_const3( |
| 1310 | struct witness ***, |
| 1311 | &witnesses), |
| 1312 | &txsig_tlvs)) |
| 1313 | open_err_fatal(state, "Bad tx_signatures %s", |
| 1314 | tal_hex(msg, msg)); |
| 1315 | |
| 1316 | /* Maybe they didn't get our channel_ready message ? */ |
| 1317 | if (state->channel_ready[LOCAL]) { |
| 1318 | if (!state->tx_state->remote_funding_sigs_rcvd) { |
| 1319 | state->tx_state->remote_funding_sigs_rcvd = true; |
| 1320 | status_info("Got WIRE_TX_SIGNATURES after channel_ready " |
| 1321 | "for channel %s, ignoring: %s", |
| 1322 | fmt_channel_id(tmpctx, |
| 1323 | &state->channel_id), |
| 1324 | tal_hex(tmpctx, msg)); |
| 1325 | } else { |
| 1326 | status_broken("Got WIRE_TX_SIGNATURES after channel_ready " |
| 1327 | "for channel %s, ignoring: %s", |
| 1328 | fmt_channel_id(tmpctx, |
| 1329 | &state->channel_id), |
| 1330 | tal_hex(tmpctx, msg)); |
| 1331 | } |
| 1332 | return; |
| 1333 | } |
| 1334 | |
| 1335 | if (state->channel_ready[REMOTE]) |
| 1336 | open_err_warn(state, |
| 1337 | "tx_signatures sent after channel_ready %s", |
| 1338 | tal_hex(msg, msg)); |
| 1339 | |
| 1340 | if (!tx_state->psbt) |
| 1341 | open_err_warn(state, |
| 1342 | "tx_signatures for %s received," |
| 1343 | " open negotiation still in progress.", |
| 1344 | fmt_bitcoin_txid(tmpctx, |
| 1345 | &txid)); |
| 1346 | |
| 1347 | |
| 1348 | if (!bitcoin_txid_eq(&tx_state->funding.txid, &txid)) |
| 1349 | open_err_warn(state, |
| 1350 | "tx_signatures for %s received," |
| 1351 | "working on funding_txid %s", |
| 1352 | fmt_bitcoin_txid(tmpctx, |
| 1353 | &txid), |
| 1354 | fmt_bitcoin_txid(tmpctx, |
| 1355 | &tx_state->funding.txid)); |
| 1356 | |
| 1357 | if (!tx_state->has_commitments) |
no test coverage detected