channeld: defer construction of revocation message until master sync

This commit is contained in:
Ken Sedgwick 2024-01-17 13:14:24 -08:00 committed by Rusty Russell
parent d463b8d900
commit 019169fc9a

View file

@ -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));
}