rust-lightning/lightning/src
Jeffrey Czyz 10cfe5c973
Fix scorer panic when available capacity is zero
ProbabilisticScorer takes a ChannelUsage when computing a penalty for a
channel. The formula for calculating the liquidity penalty reduces the
maximum capacity by the amount of in-flight HTLCs (available capacity)
and adds one to prevent division by zero.

However, since the available capacity is passed to
DirectedChannelLiquidity as the capacity, other penalty formulas may use
the available (i.e., reduced) capacity inadvertently. In practice, this
has two ramifications for the historical liquidity penalty computation:

1. The bucket formula doesn't have a consistent denominator for a given
   channel.
2. The bucket formula may divide by zero when the in-flight HTLC amount
   equals or exceeds the effective capacity.

Fixing this involves only using the available capacity when appropriate.
2023-03-03 09:41:42 -06:00
..
chain Make sure individual mutexes are constructed on different lines 2023-02-28 01:06:35 +00:00
ln Merge pull request #2006 from TheBlueMatt/2023-02-no-recursive-read-locks 2023-02-28 00:24:16 -08:00
offers Fix amount overflow in Invoice building 2023-02-23 18:25:50 -06:00
onion_message Add an inbound flag to the peer_connected message handlers 2023-02-21 22:00:42 +00:00
routing Fix scorer panic when available capacity is zero 2023-03-03 09:41:42 -06:00
sync Make sure individual mutexes are constructed on different lines 2023-02-28 01:06:35 +00:00
util Support ReadableArgs types across in the TLV struct serialization 2023-02-27 22:31:11 +00:00
lib.rs Make offers module public 2023-02-03 15:23:43 -06:00