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

Function handle_send_tx_sigs

openingd/dualopend.c:1007–1047  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1005}
1006
1007static 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
1049static struct wally_psbt *
1050fetch_psbt_changes(struct state *state,

Callers 3

accepter_startFunction · 0.85
rbf_wrap_upFunction · 0.85
handle_master_inFunction · 0.85

Calls 10

psbt_txidFunction · 0.85
tal_wally_startFunction · 0.85
tal_wally_endFunction · 0.85
tal_freeFunction · 0.85
psbt_to_tx_sigs_msgFunction · 0.85
peer_writeFunction · 0.85
master_badmsgFunction · 0.50
status_failedFunction · 0.50
type_to_stringClass · 0.50
wire_sync_writeFunction · 0.50

Tested by

no test coverage detected