| 918 | } |
| 919 | |
| 920 | static void handle_tx_sigs(struct state *state, const u8 *msg) |
| 921 | { |
| 922 | struct channel_id cid; |
| 923 | struct bitcoin_txid txid; |
| 924 | const struct witness_stack **ws; |
| 925 | size_t j = 0; |
| 926 | struct tx_state *tx_state = state->tx_state; |
| 927 | enum tx_role their_role = state->our_role == TX_INITIATOR ? |
| 928 | TX_ACCEPTER : TX_INITIATOR; |
| 929 | |
| 930 | if (!fromwire_tx_signatures(tmpctx, msg, &cid, &txid, |
| 931 | cast_const3( |
| 932 | struct witness_stack ***, |
| 933 | &ws))) |
| 934 | open_err_fatal(state, "Bad tx_signatures %s", |
| 935 | tal_hex(msg, msg)); |
| 936 | |
| 937 | /* Maybe they didn't get our channel_ready message ? */ |
| 938 | if (state->channel_ready[LOCAL] && !state->reconnected) { |
| 939 | status_broken("Got WIRE_TX_SIGNATURES after channel_ready " |
| 940 | "for channel %s, ignoring: %s", |
| 941 | type_to_string(tmpctx, struct channel_id, |
| 942 | &state->channel_id), |
| 943 | tal_hex(tmpctx, msg)); |
| 944 | return; |
| 945 | } |
| 946 | |
| 947 | /* On reconnect, we expect them to resend tx_sigs if they haven't |
| 948 | * gotten our channel_ready yet */ |
| 949 | if (state->channel_ready[REMOTE] && !state->reconnected) |
| 950 | open_err_warn(state, |
| 951 | "tx_signatures sent after channel_ready %s", |
| 952 | tal_hex(msg, msg)); |
| 953 | |
| 954 | if (!tx_state->psbt) |
| 955 | open_err_warn(state, |
| 956 | "tx_signatures for %s received," |
| 957 | " open negotiation still in progress.", |
| 958 | type_to_string(tmpctx, |
| 959 | struct bitcoin_txid, |
| 960 | &txid)); |
| 961 | |
| 962 | |
| 963 | if (!bitcoin_txid_eq(&tx_state->funding.txid, &txid)) |
| 964 | open_err_warn(state, |
| 965 | "tx_signatures for %s received," |
| 966 | "working on funding_txid %s", |
| 967 | type_to_string(tmpctx, |
| 968 | struct bitcoin_txid, |
| 969 | &txid), |
| 970 | type_to_string(tmpctx, |
| 971 | struct bitcoin_txid, |
| 972 | &tx_state->funding.txid)); |
| 973 | |
| 974 | /* We put the PSBT + sigs all together */ |
| 975 | for (size_t i = 0; i < tx_state->psbt->num_inputs; i++) { |
| 976 | struct wally_psbt_input *in = |
| 977 | &tx_state->psbt->inputs[i]; |
no test coverage detected