gossipd: clean up local channel updates.

Make update_local_channel use a timer if it's too soon to make another
update.

1. Implement cupdate_different() which compares two updates.
2. make update_local_channel() take a single arg for timer usage.
3. Set timestamp of non-disable update back 5 minutes, so we can
   always generate a disable update if we need to.
4. Make update_local_channel() itself do the "unchanged update" suppression.
   gossipd: clean up local channel updates.
5. Keep pointer to the current timer so we override any old updates with
   a new one, to avoid a race.

Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
This commit is contained in:
Rusty Russell
2019-09-16 20:13:59 +09:30
parent e1c431d278
commit 0bab2580fc
5 changed files with 158 additions and 135 deletions

View File

@@ -66,6 +66,9 @@ struct local_chan {
/* We soft-disable local channels when a peer disconnects */
bool local_disabled;
/* Timer if we're deferring an update. */
struct oneshot *channel_update_timer;
};
/* Use this instead of tal_free(chan)! */