channeld: Explicitly use the first commitment point on reconnect

The spec explicitly asks for the first point, while we were using the
most recent one. This worked fine before zeroconf, but with zeroconf
it can happen.
This commit is contained in:
Christian Decker 2022-05-31 23:40:59 +02:00
parent b195e6d9d4
commit 19f8ed3fe1
1 changed files with 8 additions and 3 deletions

View File

@ -3217,6 +3217,7 @@ static void handle_funding_depth(struct peer *peer, const u8 *msg)
u32 depth;
struct short_channel_id *scid, *alias_local;
struct tlv_funding_locked_tlvs *tlvs;
struct pubkey point;
if (!fromwire_channeld_funding_depth(tmpctx,
msg,
@ -3253,9 +3254,13 @@ static void handle_funding_depth(struct peer *peer, const u8 *msg)
tlvs = tlv_funding_locked_tlvs_new(tmpctx);
tlvs->alias = alias_local;
msg = towire_funding_locked(
NULL, &peer->channel_id,
&peer->next_local_per_commit, tlvs);
/* Need to retrieve the first point again, even if we
* moved on, as funding_locked explicitly includes the
* first one. */
get_per_commitment_point(1, &point, NULL);
msg = towire_funding_locked(NULL, &peer->channel_id,
&point, tlvs);
peer_write(peer->pps, take(msg));
peer->funding_locked[LOCAL] = true;