Move the final CLTV delta to `PaymentParameters` from `RouteParams`
authorMatt Corallo <git@bluematt.me>
Fri, 27 Jan 2023 19:24:52 +0000 (19:24 +0000)
committerMatt Corallo <git@bluematt.me>
Wed, 1 Feb 2023 17:50:24 +0000 (17:50 +0000)
commitfbc08477e8dcdd8f3f2ada8ca77388b6185febe2
tree405e8026589feadab494d17698eefc59458ac3a4
parentd4de913ae7bc9381ec6dc4e5f4494e201226d26c
Move the final CLTV delta to `PaymentParameters` from `RouteParams`

`PaymentParams` is all about the parameters for a payment, i.e. the
parameters which are static across all the paths of a paymet.
`RouteParameters` is about the information specific to a given
`Route` (i.e. a set of paths, among multiple potential sets of
paths for a payment). The CLTV delta thus doesn't belong in
`RouterParameters` but instead in `PaymentParameters`.

Worse, because `RouteParameters` is built from the information in
the last hops of a `Route`, when we deliberately inflate the CLTV
delta in path-finding, retries of the payment will have the final
CLTV delta double-inflated as it inflates starting from the final
CLTV delta used in the last attempt.

By moving the CLTV delta to `PaymentParameters` we avoid this
issue, leaving only the sought amount in the `RouteParameters`.
13 files changed:
fuzz/src/full_stack.rs
fuzz/src/router.rs
lightning-invoice/src/payment.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/onion_route_tests.rs
lightning/src/ln/outbound_payment.rs
lightning/src/ln/payment_tests.rs
lightning/src/ln/priv_short_conf_tests.rs
lightning/src/ln/shutdown_tests.rs
lightning/src/routing/router.rs