mirror of
https://github.com/ElementsProject/lightning.git
synced 2025-02-20 13:54:36 +01:00
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)
This commit is contained in:
parent
7ad8fde060
commit
57dd5be2fd
4 changed files with 13 additions and 7 deletions
2
Makefile
2
Makefile
|
@ -24,7 +24,7 @@ CCANDIR := ccan
|
|||
|
||||
# Where we keep the BOLT RFCs
|
||||
BOLTDIR := ../lightning-rfc/
|
||||
BOLTVERSION := b4132ff24025742ad8e175d52b68380520e9f0b7
|
||||
BOLTVERSION := 7e8c478aef0d23a445845b7d297b0e804583697c
|
||||
|
||||
-include config.vars
|
||||
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -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.
|
||||
|
|
|
@ -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…
Add table
Reference in a new issue