]> git.bitcoin.ninja Git - rust-lightning/commit
Update `ChannelUpdate::timestamp` when channels are dis-/en-abled
authorMatt Corallo <git@bluematt.me>
Sat, 13 Nov 2021 01:06:09 +0000 (01:06 +0000)
committerMatt Corallo <git@bluematt.me>
Tue, 23 Nov 2021 22:17:18 +0000 (22:17 +0000)
commit8f89371bae42d127f28b4362322682fe22718175
tree11ea8089cdde389a516aa793127f02f2570bb53a
parent74828d243567af448cec5f09eb2d6a8eeed3ca48
Update `ChannelUpdate::timestamp` when channels are dis-/en-abled

We update the `Channel::update_time_counter` field (which is copied
into `ChannelUpdate::timestamp`) only when the channel is
initialized or closes, and when a new block is connected. However,
if a peer disconnects or reconnects, we may wish to generate
`ChannelUpdate` updates in between new blocks. In such a case, we
need to make sure the `timestamp` field is newer than any previous
updates' `timestamp` fields, which we do here by simply
incrementing it when the channel status is changed.

As a side effect of this we have to update
`test_background_processor` to ensure it eventually succeeds even
if the serialization of the `ChannelManager` changes after the test
begins.
lightning-background-processor/src/lib.rs
lightning/src/ln/channel.rs
lightning/src/ln/functional_tests.rs