From 019169fc9a1bb12288f5c2de5f97161d54f91e5d Mon Sep 17 00:00:00 2001 From: Ken Sedgwick Date: Wed, 17 Jan 2024 13:14:24 -0800 Subject: [PATCH] channeld: defer construction of revocation message until master sync --- channeld/channeld.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/channeld/channeld.c b/channeld/channeld.c index 6f1811705..2e3986c69 100644 --- a/channeld/channeld.c +++ b/channeld/channeld.c @@ -1934,11 +1934,6 @@ static void send_revocation(struct peer *peer, &failed, &added); - /* Revoke previous commit, get new point. */ - msg = make_revocation_msg_from_secret(peer, peer->next_index[LOCAL]-1, - &peer->next_local_per_commit, - old_secret, next_point); - /* From now on we apply changes to the next commitment */ peer->next_index[LOCAL]++; @@ -1969,6 +1964,11 @@ static void send_revocation(struct peer *peer, peer->splice_state->await_commitment_succcess = false; + /* Revoke previous commit, get new point. */ + msg = make_revocation_msg_from_secret(peer, peer->next_index[LOCAL]-2, + &peer->next_local_per_commit, + old_secret, next_point); + /* Now we can finally send revoke_and_ack to peer */ peer_write(peer->pps, take(msg)); }