mirror of
https://github.com/ElementsProject/lightning.git
synced 2024-11-19 18:11:28 +01:00
gossipd: simplify "broadcast channel_announcement now we have channel_update" logic
It's simpler and more robust to just check that it's not yet announced (the broadcast index will be 0). Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
parent
eee31a1519
commit
66105e83ea
@ -1055,7 +1055,6 @@ bool routing_add_channel_update(struct routing_state *rstate,
|
||||
struct bitcoin_blkid chain_hash;
|
||||
struct chan *chan;
|
||||
u8 direction;
|
||||
bool have_broadcast_announce;
|
||||
|
||||
if (!fromwire_channel_update(update, &signature, &chain_hash,
|
||||
&short_channel_id, ×tamp,
|
||||
@ -1067,10 +1066,6 @@ bool routing_add_channel_update(struct routing_state *rstate,
|
||||
if (!chan)
|
||||
return false;
|
||||
|
||||
/* We broadcast announce once we have one update */
|
||||
have_broadcast_announce = is_halfchan_defined(&chan->half[0])
|
||||
|| is_halfchan_defined(&chan->half[1]);
|
||||
|
||||
direction = channel_flags & 0x1;
|
||||
set_connection_values(chan, direction, fee_base_msat,
|
||||
fee_proportional_millionths, expiry,
|
||||
@ -1093,7 +1088,7 @@ bool routing_add_channel_update(struct routing_state *rstate,
|
||||
* - MUST consider whether to send the `channel_announcement` after
|
||||
* receiving the first corresponding `channel_update`.
|
||||
*/
|
||||
if (!have_broadcast_announce)
|
||||
if (chan->channel_announcement_index == 0)
|
||||
add_channel_announce_to_broadcast(rstate, chan, timestamp);
|
||||
|
||||
persistent_broadcast(rstate, chan->half[direction].channel_update,
|
||||
|
Loading…
Reference in New Issue
Block a user