From 122b75eac7b1c68ac6cc1fe4dc23fad8ac2389c0 Mon Sep 17 00:00:00 2001 From: Matt Corallo Date: Tue, 25 Feb 2020 13:32:13 -0500 Subject: [PATCH] Use block timestamps as the min for generated update messages. Fixes issue #493 and should resolve some issues where other nodes (incorrectly) reject channel_update/node_announcement messages which have a serial number that is not a relatively recent timestamp. --- lightning/src/ln/channel.rs | 1 + lightning/src/ln/channelmanager.rs | 10 ++++++++++ 2 files changed, 11 insertions(+) diff --git a/lightning/src/ln/channel.rs b/lightning/src/ln/channel.rs index f155a0bd2..b0f544503 100644 --- a/lightning/src/ln/channel.rs +++ b/lightning/src/ln/channel.rs @@ -3175,6 +3175,7 @@ impl Channel { } if header.bitcoin_hash() != self.last_block_connected { self.last_block_connected = header.bitcoin_hash(); + self.channel_update_count = cmp::max(self.channel_update_count, header.time); if let Some(channel_monitor) = self.channel_monitor.as_mut() { channel_monitor.last_block_hash = self.last_block_connected; } diff --git a/lightning/src/ln/channelmanager.rs b/lightning/src/ln/channelmanager.rs index 784173e13..3a53c3f4a 100644 --- a/lightning/src/ln/channelmanager.rs +++ b/lightning/src/ln/channelmanager.rs @@ -2758,6 +2758,16 @@ impl