Browse Source

gossipd: prune channels unless *both* peers have refreshed.

See https://github.com/lightningnetwork/lightning-rfc/pull/767

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Changelog-Changed: Protocol: channels now pruned after two weeks unless both peers refresh it (see lightning-rfc#767)
bump-pyln-proto
Rusty Russell 4 years ago
parent
commit
57dd5be2fd
  1. 2
      Makefile
  2. 2
      common/gossip_constants.h
  3. 2
      gossipd/gossipd.c
  4. 14
      gossipd/routing.c

2
Makefile

@ -24,7 +24,7 @@ CCANDIR := ccan
# Where we keep the BOLT RFCs
BOLTDIR := ../lightning-rfc/
BOLTVERSION := b4132ff24025742ad8e175d52b68380520e9f0b7
BOLTVERSION := 7e8c478aef0d23a445845b7d297b0e804583697c
-include config.vars

2
common/gossip_constants.h

@ -58,7 +58,7 @@
/* BOLT #7:
*
* A node:
* - if a channel's latest `channel_update`s `timestamp` is older than two weeks
* - if a channel's oldest `channel_update`s `timestamp` is older than two weeks
* (1209600 seconds):
* - MAY prune the channel.
* - MAY ignore the channel.

2
gossipd/gossipd.c

@ -725,7 +725,7 @@ static void gossip_send_keepalive_update(struct daemon *daemon,
/* BOLT #7:
*
* A node:
* - if a channel's latest `channel_update`s `timestamp` is older than two weeks
* - if a channel's oldest `channel_update`s `timestamp` is older than two weeks
* (1209600 seconds):
* - MAY prune the channel.
* - MAY ignore the channel.

14
gossipd/routing.c

@ -2777,10 +2777,16 @@ void route_prune(struct routing_state *rstate)
if (!is_chan_public(chan))
continue;
if ((!is_halfchan_defined(&chan->half[0])
|| chan->half[0].bcast.timestamp < highwater)
&& (!is_halfchan_defined(&chan->half[1])
|| chan->half[1].bcast.timestamp < highwater)) {
/* BOLT #7:
* - if a channel's oldest `channel_update`s `timestamp` is
* older than two weeks (1209600 seconds):
* - MAY prune the channel.
*/
/* This is a fancy way of saying "both ends must refresh!" */
if (!is_halfchan_defined(&chan->half[0])
|| chan->half[0].bcast.timestamp < highwater
|| !is_halfchan_defined(&chan->half[1])
|| chan->half[1].bcast.timestamp < highwater) {
status_debug(
"Pruning channel %s from network view (ages %"PRIu64" and %"PRIu64"s)",
type_to_string(tmpctx, struct short_channel_id,

Loading…
Cancel
Save