MCPcopy Create free account
hub / github.com/ElementsProject/lightning / handle_tx_sigs

Function handle_tx_sigs

openingd/dualopend.c:920–1005  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

918}
919
920static 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];

Callers 2

opening_negotiate_msgFunction · 0.85
handle_peer_inFunction · 0.85

Calls 7

open_err_fatalFunction · 0.85
tal_hexFunction · 0.85
open_err_warnFunction · 0.85
psbt_get_serial_idFunction · 0.85
psbt_finalize_inputFunction · 0.85
type_to_stringClass · 0.50
wire_sync_writeFunction · 0.50

Tested by

no test coverage detected