mirror of
https://github.com/ElementsProject/lightning.git
synced 2025-03-26 20:30:59 +01:00
gossipd: at startup don't send remote channel_update as init update from us.
The "init_cupdate" message is for gossipd to tell lightningd about our *own* latest channel_update messages, not the remote ones! The "remote_channel_update" message is for messages from the peer. This appeared as an occasional BROKEN message in CI: ``` **BROKEN** 035d2b1192dfba134e10e540875d366ebc8bc353d5aa766b80c090b39c3a5d885d-chan#4: gossipd gave us channel_update for channel in gossip_state CGOSSIP_NEED_PEER_SIGS ``` Where we had sent (and not received) announcement_signatures, and restarted: the peer had meanwhile sent us their channel_announcement and channel_update. Signed-off-by: Rusty Russell <rusty@rustcorp.com.au> Changelog-Fixed: Protocol: we could get confused on restart and not re-transmit our own channel_updates.
This commit is contained in:
parent
4e6bac6d36
commit
7d02d5749a
1 changed files with 26 additions and 7 deletions
|
@ -1375,23 +1375,42 @@ void gossmap_manage_tell_lightningd_locals(struct daemon *daemon,
|
|||
return;
|
||||
|
||||
for (size_t i = 0; i < me->num_chans; i++) {
|
||||
struct gossmap_chan *chan = gossmap_nth_chan(gossmap, me, i, NULL);
|
||||
int dir;
|
||||
struct gossmap_chan *chan = gossmap_nth_chan(gossmap, me, i, &dir);
|
||||
struct short_channel_id scid;
|
||||
const u8 *cupdate;
|
||||
|
||||
scid = gossmap_chan_scid(gossmap, chan);
|
||||
cupdate = gossmap_chan_get_update(tmpctx, gossmap, chan, 0);
|
||||
cupdate = gossmap_chan_get_update(tmpctx, gossmap, chan, dir);
|
||||
if (cupdate)
|
||||
daemon_conn_send(daemon->master,
|
||||
take(towire_gossipd_init_cupdate(NULL,
|
||||
scid,
|
||||
cupdate)));
|
||||
cupdate = gossmap_chan_get_update(tmpctx, gossmap, chan, 1);
|
||||
if (cupdate)
|
||||
cupdate = gossmap_chan_get_update(tmpctx, gossmap, chan, !dir);
|
||||
if (cupdate) {
|
||||
struct peer_update peer_update;
|
||||
secp256k1_ecdsa_signature signature;
|
||||
u32 timestamp;
|
||||
u8 message_flags, channel_flags;
|
||||
struct bitcoin_blkid chain_hash;
|
||||
if (!fromwire_channel_update(cupdate, &signature,
|
||||
&chain_hash, &peer_update.scid,
|
||||
×tamp, &message_flags,
|
||||
&channel_flags, &peer_update.cltv_delta,
|
||||
&peer_update.htlc_minimum_msat,
|
||||
&peer_update.fee_base,
|
||||
&peer_update.fee_ppm,
|
||||
&peer_update.htlc_maximum_msat)) {
|
||||
status_broken("Invalid remote cupdate in store: %s",
|
||||
tal_hex(tmpctx, cupdate));
|
||||
continue;
|
||||
}
|
||||
daemon_conn_send(daemon->master,
|
||||
take(towire_gossipd_init_cupdate(NULL,
|
||||
scid,
|
||||
cupdate)));
|
||||
take(towire_gossipd_remote_channel_update(NULL,
|
||||
NULL,
|
||||
&peer_update)));
|
||||
}
|
||||
}
|
||||
|
||||
/* Tell lightningd about our current node_announcement, if any */
|
||||
|
|
Loading…
Add table
Reference in a new issue