]> git.bitcoin.ninja Git - rust-lightning/commit
Parameterize Scorer by a Time trait
authorJeffrey Czyz <jkczyz@gmail.com>
Fri, 29 Oct 2021 13:52:27 +0000 (08:52 -0500)
committerJeffrey Czyz <jkczyz@gmail.com>
Tue, 2 Nov 2021 19:48:39 +0000 (14:48 -0500)
commita8d3b5aabf88487cb72dccd4553ba1894166fbb9
treeeb34d13d9ffbc97c5b47662c9a280eb1a0c6bdaf
parent88cf9b33c3982376b22d34ddaa4a958bf0d11bfd
Parameterize Scorer by a Time trait

Scorer uses time to determine how much to penalize a channel after a
failure occurs. Parameterizing it by time cleans up the code such that
no-std support is in a single AlwaysPresent struct, which implements the
Time trait. Time is implemented for std::time::Instant when std is
available.

This parameterization also allows for deterministic testing since a
clock could be devised to advance forward as needed.
lightning-background-processor/src/lib.rs
lightning-invoice/src/utils.rs
lightning/src/ln/channelmanager.rs
lightning/src/ln/functional_test_utils.rs
lightning/src/ln/functional_tests.rs
lightning/src/ln/shutdown_tests.rs
lightning/src/routing/router.rs
lightning/src/routing/scorer.rs
lightning/src/util/test_utils.rs