BOLT #7: * * A node: * - if the `timestamp` of the latest `channel_update` in * either direction is older than two weeks (1209600 seconds): * - MAY prune the channel. * - MAY ignore the channel. */
| 608 | * - MAY ignore the channel. |
| 609 | */ |
| 610 | static void gossip_refresh_network(struct daemon *daemon) |
| 611 | { |
| 612 | u64 now = gossip_time_now(daemon->rstate).ts.tv_sec; |
| 613 | s64 highwater; |
| 614 | struct node *n; |
| 615 | |
| 616 | /* Send out 1 day before deadline */ |
| 617 | highwater = now - (GOSSIP_PRUNE_INTERVAL(daemon->rstate->dev_fast_gossip) |
| 618 | - GOSSIP_BEFORE_DEADLINE(daemon->rstate->dev_fast_gossip_prune)); |
| 619 | |
| 620 | /* Schedule next run now */ |
| 621 | notleak(new_reltimer(&daemon->timers, daemon, |
| 622 | time_from_sec(GOSSIP_PRUNE_INTERVAL(daemon->rstate->dev_fast_gossip_prune)/4), |
| 623 | gossip_refresh_network, daemon)); |
| 624 | |
| 625 | /* Find myself in the network */ |
| 626 | n = get_node(daemon->rstate, &daemon->id); |
| 627 | if (n) { |
| 628 | /* Iterate through all outgoing connection and check whether |
| 629 | * it's time to re-announce */ |
| 630 | struct chan_map_iter i; |
| 631 | struct chan *c; |
| 632 | |
| 633 | for (c = first_chan(n, &i); c; c = next_chan(n, &i)) { |
| 634 | struct half_chan *hc; |
| 635 | int direction; |
| 636 | |
| 637 | if (!local_direction(daemon->rstate, c, &direction)) |
| 638 | continue; |
| 639 | |
| 640 | hc = &c->half[direction]; |
| 641 | |
| 642 | if (!is_halfchan_defined(hc)) { |
| 643 | /* Connection is not announced yet, so don't even |
| 644 | * try to re-announce it */ |
| 645 | continue; |
| 646 | } |
| 647 | |
| 648 | if (hc->bcast.timestamp > highwater) { |
| 649 | /* No need to send a keepalive update message */ |
| 650 | continue; |
| 651 | } |
| 652 | |
| 653 | status_debug("Sending keepalive channel_update" |
| 654 | " for %s/%u", |
| 655 | type_to_string(tmpctx, |
| 656 | struct short_channel_id, |
| 657 | &c->scid), direction); |
| 658 | refresh_local_channel(daemon, c, direction); |
| 659 | } |
| 660 | } |
| 661 | |
| 662 | /* Now we've refreshed our channels, we can prune without clobbering |
| 663 | * them */ |
| 664 | route_prune(daemon->rstate); |
| 665 | } |
| 666 | |
| 667 | /* Disables all channels connected to our node. */ |
nothing calls this directly
no test coverage detected