Avoid panicking on wallclock time going backwards across restart 2022-07-no-backwards-time
authorMatt Corallo <git@bluematt.me>
Fri, 8 Jul 2022 01:16:05 +0000 (01:16 +0000)
committerMatt Corallo <git@bluematt.me>
Mon, 11 Jul 2022 18:49:22 +0000 (18:49 +0000)
commit497fd65ae935be58af1d14e5f1440160d97def9a
treefb4d0ed5910ab47e4a29723766b48c46d11eeaaa
parentf3d5b945c3c9d5b1d9abb3d1cd58f4159d1084e3
Avoid panicking on wallclock time going backwards across restart

Because we serialize `Instant`s using wallclock time in
`ProbabilisticScorer`, if time goes backwards across restarts we
may end up with `Instant`s in the future, which causes rustc prior
to 1.60 to panic when calculating durations. Here we simply avoid
this by setting the time to `now` if we get a time in the future.
lightning/src/routing/scoring.rs