splice: Update splice signature msg type

Update to use spec signature type.

Changelog-None
This commit is contained in:
Dusty Daemon
2024-10-04 16:09:32 -04:00
committed by Rusty Russell
parent d077fd59c9
commit 2b3cb8b8a8
3 changed files with 7 additions and 24 deletions

View File

@@ -3218,8 +3218,6 @@ static void resume_splice_negotiation(struct peer *peer,
struct wally_psbt *current_psbt = inflight->psbt;
struct commitsig *their_commit;
const struct witness **outws;
u8 der[73];
size_t der_len;
struct bitcoin_signature splice_sig;
struct bitcoin_tx *bitcoin_tx;
u32 splice_funding_index;
@@ -3331,9 +3329,7 @@ static void resume_splice_negotiation(struct peer *peer,
fmt_wally_psbt(tmpctx, current_psbt));
txsig_tlvs = tlv_txsigs_tlvs_new(tmpctx);
der_len = signature_to_der(der, &splice_sig);
txsig_tlvs->funding_outpoint_sig = tal_dup_arr(tmpctx, u8, der,
der_len, 0);
txsig_tlvs->shared_input_signature = &splice_sig.s;
/* DTODO: is this finalize call required? */
psbt_finalize(current_psbt);
@@ -3422,21 +3418,8 @@ static void resume_splice_negotiation(struct peer *peer,
/* BOLT-a8b9f495cac28124c69cc5ee429f9ef2bacb9921 #2:
* Both nodes:
* - MUST sign the transaction using SIGHASH_ALL */
their_sig->sighash_type = SIGHASH_ALL;
if (!signature_from_der(their_txsigs_tlvs->funding_outpoint_sig,
tal_count(their_txsigs_tlvs->funding_outpoint_sig),
their_sig)) {
tal_free(their_txsigs_tlvs);
peer_failed_warn(peer->pps, &peer->channel_id,
"Splicing bad tx_signatures %s",
tal_hex(msg, msg));
}
if (peer->splicing)
peer->splicing->their_sig = tal_steal(peer->splicing,
their_sig);
tal_free(their_txsigs_tlvs);
their_sig.sighash_type = SIGHASH_ALL;
their_sig.s = *their_txsigs_tlvs->shared_input_signature;
/* Set the commit_sig on the commitment tx psbt */
if (!psbt_input_set_signature(current_psbt,

View File

@@ -58,8 +58,8 @@ static bool equal(const struct tx_signatures *x, const struct tx_signatures *y)
return false;
assert(x->tlvs && y->tlvs);
return tal_arr_eq(x->tlvs->funding_outpoint_sig,
y->tlvs->funding_outpoint_sig);
return tal_arr_eq(x->tlvs->shared_input_signature,
y->tlvs->shared_input_signature);
}
void run(const u8 *data, size_t size)

View File

@@ -70,8 +70,8 @@ msgdata,tx_signatures,tlvs,txsigs_tlvs,
subtype,witness
subtypedata,witness,len,u16,
subtypedata,witness,witness_data,byte,len
tlvtype,txsigs_tlvs,funding_outpoint_sig,0
tlvdata,txsigs_tlvs,funding_outpoint_sig,sig,byte,...
tlvtype,txsigs_tlvs,shared_input_signature,0
tlvdata,txsigs_tlvs,shared_input_signature,signature,signature,
msgtype,tx_init_rbf,72
msgdata,tx_init_rbf,channel_id,channel_id,
msgdata,tx_init_rbf,locktime,u32,
1 msgtype,init,16
70 subtype,witness
71 subtypedata,witness,len,u16,
72 subtypedata,witness,witness_data,byte,len
73 tlvtype,txsigs_tlvs,funding_outpoint_sig,0 tlvtype,txsigs_tlvs,shared_input_signature,0
74 tlvdata,txsigs_tlvs,funding_outpoint_sig,sig,byte,... tlvdata,txsigs_tlvs,shared_input_signature,signature,signature,
75 msgtype,tx_init_rbf,72
76 msgdata,tx_init_rbf,channel_id,channel_id,
77 msgdata,tx_init_rbf,locktime,u32,