Skip to content

Commit 6cb7e1d

Browse files
committed
splice: Message sorting should be using txid parsing
Update from old channel_id non-spec version
1 parent a95915f commit 6cb7e1d

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

channeld/channeld.c

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2221,7 +2221,7 @@ static struct commitsig_info *handle_peer_commit_sig(struct peer *peer,
22212221
*/
22222222
static int commit_index_from_msg(const u8 *msg, struct peer *peer)
22232223
{
2224-
struct channel_id funding_id;
2224+
struct bitcoin_txid funding_txid;
22252225
struct channel_id channel_id;
22262226
struct bitcoin_signature commit_sig;
22272227
secp256k1_ecdsa_signature *raw_sigs;
@@ -2230,18 +2230,18 @@ static int commit_index_from_msg(const u8 *msg, struct peer *peer)
22302230
fromwire_commitment_signed(tmpctx, msg, &channel_id, &commit_sig.s,
22312231
&raw_sigs, &cs_tlv);
22322232

2233-
derive_channel_id(&funding_id, &peer->channel->funding);
2234-
if (channel_id_eq(&funding_id, &channel_id))
2235-
return 0;
2233+
if (!cs_tlv || !cs_tlv->splice_info)
2234+
return -1;
22362235

2237-
for (int i = 0; i < tal_count(peer->splice_state->inflights); i++) {
2238-
struct channel_id splice_id;
2239-
derive_channel_id(&splice_id,
2240-
&peer->splice_state->inflights[i]->outpoint);
2236+
funding_txid = cs_tlv->splice_info->funding_txid;
22412237

2242-
if (channel_id_eq(&splice_id, &channel_id))
2238+
if (bitcoin_txid_eq(&funding_txid, &peer->channel->funding.txid))
2239+
return 0;
2240+
2241+
for (int i = 0; i < tal_count(peer->splice_state->inflights); i++)
2242+
if (bitcoin_txid_eq(&funding_txid,
2243+
&peer->splice_state->inflights[i]->outpoint.txid))
22432244
return i + 1;
2244-
}
22452245

22462246
return -1;
22472247
}

0 commit comments

Comments
 (0)