]> git.bitcoin.ninja Git - rust-lightning/commit
Consider counterparty commitment tx fees when assembling a route
authorMatt Corallo <git@bluematt.me>
Tue, 16 May 2023 03:26:21 +0000 (03:26 +0000)
committerMatt Corallo <git@bluematt.me>
Tue, 6 Jun 2023 23:57:55 +0000 (23:57 +0000)
commit52a90577f2b8eb67d6abe26242c63041212e8115
tree31487d2c37018b63907ae6b75a8dbdd2d61949ff
parentb09ccd10be82a0093ae7b1b196c739fb8f32c42b
Consider counterparty commitment tx fees when assembling a route

When calculating the amount available to send for the next HTLC, if
we over-count we may create routes which are not actually usable.

Historically this has been an issue, which we resolve over a few
commits.

Here we consider whether one additional HTLC's commitment tx fees
would result in the counterparty's commitment tx fees being greater
than the reserve we've picked for them and, if so, limit our next
HTLC value to only include dust HTLCs.

We also add some testing when sending to ensure that send failures
are accounted for in our balance calculations.

This, and the previous few commits, fixes #1126.
lightning/src/ln/channel.rs
lightning/src/ln/functional_tests.rs