Keep track of inflight HTLCs across payments
authorjurvis <hello@jurvis.co>
Tue, 30 Aug 2022 05:50:44 +0000 (22:50 -0700)
committerjurvis <hello@jurvis.co>
Thu, 1 Sep 2022 01:50:02 +0000 (18:50 -0700)
commitc70bd1fd558513e72fa03dc16f9556882883046e
treeb90d46214b7d3d9018750792697fc125b17e83bb
parent706b638196aa4c379fb6ca177494148b4c991bf3
Keep track of inflight HTLCs across payments

Added two methods, `process_path_inflight_htlcs` and
`remove_path_inflight_htlcs`, that updates that `payment_cache` map with
path information that may have failed, succeeded, or have been given up
on.

Introduced `AccountForInflightHtlcs`, which will wrap our user-provided
scorer. We move the `S:Score` type parameterization from the `Router` to
`find_route`, so we can use our newly introduced
`AccountForInflightHtlcs`.

`AccountForInflightHtlcs` keeps track of a map of inflight HTLCs by
their short channel id, direction, and give us the value that is being
used up.

This map will in turn be populated prior to calling `find_route`, where
we’ll use `create_inflight_map`, to generate a current map of all
inflight HTLCs based on what was stored in `payment_cache`.
lightning-invoice/src/payment.rs
lightning-invoice/src/utils.rs
lightning/src/routing/gossip.rs
lightning/src/routing/scoring.rs