| 1005 | } |
| 1006 | |
| 1007 | static void handle_send_tx_sigs(struct state *state, const u8 *msg) |
| 1008 | { |
| 1009 | struct wally_psbt *psbt; |
| 1010 | struct bitcoin_txid txid; |
| 1011 | struct tx_state *tx_state = state->tx_state; |
| 1012 | |
| 1013 | if (!fromwire_dualopend_send_tx_sigs(tmpctx, msg, &psbt)) |
| 1014 | master_badmsg(WIRE_DUALOPEND_SEND_TX_SIGS, msg); |
| 1015 | |
| 1016 | /* Check that we've got the same / correct PSBT */ |
| 1017 | psbt_txid(NULL, psbt, &txid, NULL); |
| 1018 | if (!bitcoin_txid_eq(&txid, &tx_state->funding.txid)) |
| 1019 | status_failed(STATUS_FAIL_INTERNAL_ERROR, |
| 1020 | "TXID for passed in PSBT does not match" |
| 1021 | " funding txid for channel. Expected %s, " |
| 1022 | "received %s", |
| 1023 | type_to_string(tmpctx, struct bitcoin_txid, |
| 1024 | &tx_state->funding.txid), |
| 1025 | type_to_string(tmpctx, struct bitcoin_txid, |
| 1026 | &txid)); |
| 1027 | |
| 1028 | tal_wally_start(); |
| 1029 | if (wally_psbt_combine(tx_state->psbt, psbt) != WALLY_OK) { |
| 1030 | tal_wally_end(tal_free(tx_state->psbt)); |
| 1031 | status_failed(STATUS_FAIL_INTERNAL_ERROR, |
| 1032 | "Unable to combine PSBTs. received %s\n" |
| 1033 | "local %s", |
| 1034 | type_to_string(tmpctx, struct wally_psbt, |
| 1035 | psbt), |
| 1036 | type_to_string(tmpctx, struct wally_psbt, |
| 1037 | tx_state->psbt)); |
| 1038 | } |
| 1039 | tal_wally_end(tx_state->psbt); |
| 1040 | |
| 1041 | /* Send our sigs to peer */ |
| 1042 | msg = psbt_to_tx_sigs_msg(tmpctx, state, tx_state->psbt); |
| 1043 | peer_write(state->pps, take(msg)); |
| 1044 | |
| 1045 | /* Notify lightningd that we've sent sigs */ |
| 1046 | wire_sync_write(REQ_FD, take(towire_dualopend_tx_sigs_sent(NULL))); |
| 1047 | } |
| 1048 | |
| 1049 | static struct wally_psbt * |
| 1050 | fetch_psbt_changes(struct state *state, |
no test coverage detected