projects
/
rust-lightning
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(from parent 1:
7b4fb9d
)
Use `saturating_add` when adding inflight HTLCs values
author
Elias Rohrer
<dev@tnull.de>
Thu, 14 Sep 2023 12:14:03 +0000
(14:14 +0200)
committer
Elias Rohrer
<dev@tnull.de>
Thu, 28 Sep 2023 08:14:35 +0000
(10:14 +0200)
Previously this calculation could overflow, leading to panicking in `debug`.
lightning/src/routing/router.rs
patch
|
blob
|
history
diff --git
a/lightning/src/routing/router.rs
b/lightning/src/routing/router.rs
index 09d83bb785cdfe1d9ac2786cce278311a6279648..0e3bc96ea00635a44becbda9f2d1bd3ff9c3bbe6 100644
(file)
--- a/
lightning/src/routing/router.rs
+++ b/
lightning/src/routing/router.rs
@@
-139,7
+139,7
@@
impl<'a, SP: Sized, Sc: 'a + ScoreLookUp<ScoreParams = SP>, S: Deref<Target = Sc
source, target, short_channel_id
) {
let usage = ChannelUsage {
- inflight_htlc_msat: usage.inflight_htlc_msat
+ used_liquidity
,
+ inflight_htlc_msat: usage.inflight_htlc_msat
.saturating_add(used_liquidity)
,
..usage
};