gossip: Limit announcement sigs reply

A splice where reestablish happens at the right moment causes an infinite loop of announcement signatures being sent back and forth.

Limit the announcement sigs we send in response to announcement sigs to once per channel session.

ChangelogNone
This commit is contained in:
Dusty Daemon
2025-05-02 13:36:52 -04:00
committed by Rusty Russell
parent 0f109d0155
commit 7f90e9679b
3 changed files with 9 additions and 1 deletions

View File

@@ -322,6 +322,7 @@ struct channel *new_unsaved_channel(struct peer *peer,
/* Nothing happened yet */
memset(&channel->stats, 0, sizeof(channel->stats));
channel->state_changes = tal_arr(channel, struct channel_state_change *, 0);
channel->replied_to_announcement_sigs = false;
/* No shachain yet */
channel->their_shachain.id = 0;
@@ -632,6 +633,7 @@ struct channel *new_channel(struct peer *peer, u64 dbid,
channel->num_onchain_spent_calls = 0;
channel->stats = *stats;
channel->state_changes = tal_steal(channel, state_changes);
channel->replied_to_announcement_sigs = false;
/* Populate channel->channel_gossip */
channel_gossip_init(channel, take(peer_update));

View File

@@ -353,6 +353,9 @@ struct channel {
/* Our change history. */
struct channel_state_change **state_changes;
/* Have we replied to announcement_signatures once? */
bool replied_to_announcement_sigs;
};
/* Is channel owned (and should be talking to peer) */

View File

@@ -688,7 +688,10 @@ void channel_gossip_got_announcement_sigs(struct channel *channel,
* - MUST respond with its own `announcement_signatures`
* message.
*/
send_channel_announce_sigs(channel);
if(!channel->replied_to_announcement_sigs) {
send_channel_announce_sigs(channel);
channel->replied_to_announcement_sigs = true;
}
check_channel_gossip(channel);
return;
}