Skip to content

Commit 29d52d1

Browse files
remyersddustin
authored andcommitted
Fixed splice_locked messgae to include splice_txid field
1 parent 000aa38 commit 29d52d1

File tree

3 files changed

+16
-8
lines changed

3 files changed

+16
-8
lines changed

channeld/channeld.c

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -511,13 +511,14 @@ static void check_mutual_splice_locked(struct peer *peer)
511511
}
512512

513513
/* Our peer told us they saw our splice confirm on chain with `splice_locked`.
514-
* If we see it to we jump into tansitioning to post-splice, otherwise we mark
514+
* If we see it to we jump into transitioning to post-splice, otherwise we mark
515515
* a flag and wait until we see it on chain too. */
516516
static void handle_peer_splice_locked(struct peer *peer, const u8 *msg)
517517
{
518518
struct channel_id chanid;
519+
struct bitcoin_txid splice_txid;
519520

520-
if (!fromwire_splice_locked(msg, &chanid))
521+
if (!fromwire_splice_locked(msg, &chanid, &splice_txid))
521522
peer_failed_warn(peer->pps, &peer->channel_id,
522523
"Bad splice_locked %s", tal_hex(msg, msg));
523524

@@ -5180,7 +5181,9 @@ static void peer_reconnect(struct peer *peer,
51805181
status_info("Splice is not confirmed but locked on"
51815182
" chain -- resending splice_locked");
51825183
peer_write(peer->pps,
5183-
take(towire_splice_locked(NULL, &peer->channel_id)));
5184+
take(towire_splice_locked(NULL,
5185+
&peer->channel_id,
5186+
&inflight->outpoint.txid)));
51845187
} else if (bitcoin_txid_eq(remote_next_funding,
51855188
&inflight->outpoint.txid)) {
51865189
/* Don't send sigs unless we have theirs */
@@ -5225,7 +5228,9 @@ static void peer_reconnect(struct peer *peer,
52255228
status_info("We have no pending splice but peer"
52265229
" expects one; resending splice_lock");
52275230
peer_write(peer->pps,
5228-
take(towire_splice_locked(NULL, &peer->channel_id)));
5231+
take(towire_splice_locked(NULL,
5232+
&peer->channel_id,
5233+
&peer->channel->funding.txid)));
52295234
}
52305235
else {
52315236
splice_abort(peer, "next_funding_txid not recognized."
@@ -5619,10 +5624,11 @@ static void handle_funding_depth(struct peer *peer, const u8 *msg)
56195624
}
56205625
}
56215626

5622-
msg = towire_splice_locked(NULL, &peer->channel_id);
5623-
56245627
peer->splice_state->locked_txid = txid;
56255628

5629+
msg = towire_splice_locked(NULL, &peer->channel_id,
5630+
&txid);
5631+
56265632
peer_write(peer->pps, take(msg));
56275633

56285634
peer->splice_state->locked_ready[LOCAL] = true;

tests/fuzz/fuzz-wire-splice_locked.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,18 +5,19 @@
55

66
struct splice_locked {
77
struct channel_id channel_id;
8+
struct bitcoin_txid txid;
89
};
910

1011
static void *encode(const tal_t *ctx, const struct splice_locked *s)
1112
{
12-
return towire_splice_locked(ctx, &s->channel_id);
13+
return towire_splice_locked(ctx, &s->channel_id, &s->txid);
1314
}
1415

1516
static struct splice_locked *decode(const tal_t *ctx, const void *p)
1617
{
1718
struct splice_locked *s = tal(ctx, struct splice_locked);
1819

19-
if (fromwire_splice_locked(p, &s->channel_id))
20+
if (fromwire_splice_locked(p, &s->channel_id, &s->txid))
2021
return s;
2122
return tal_free(s);
2223
}

wire/peer_wire.csv

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -223,6 +223,7 @@ msgdata,splice_ack,relative_satoshis,s64,
223223
msgdata,splice_ack,funding_pubkey,point,
224224
msgtype,splice_locked,77,
225225
msgdata,splice_locked,channel_id,channel_id,
226+
msgdata,splice_locked,splice_txid,sha256,
226227
msgtype,shutdown,38
227228
msgdata,shutdown,channel_id,channel_id,
228229
msgdata,shutdown,len,u16,

0 commit comments

Comments
 (0)