Skip to content

Commit 7e1ba11

Browse files
committed
f make tests a bit more clear as to the paths hit
1 parent 58c5cb3 commit 7e1ba11

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

lightning/src/routing/router.rs

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2372,17 +2372,20 @@ mod tests {
23722372
}
23732373

23742374
#[test]
2375-
fn overflow_unannounced_path_test_a() {
2375+
fn overflow_unannounced_path_test_liquidity_underflow() {
23762376
// Previously, when we had a last-hop hint connected directly to a first-hop channel, where
23772377
// the last-hop had a value-overflowing fee, we'd panic.
23782378
// This was due to us adding the first-hop from us unconditionally, causing us to think
23792379
// we'd built a path (as our node is in the "best candidate" set), when we had not.
2380+
// In this test, we previously hit a subtraction underflow due to having less available
2381+
// liquidity at a hop than 0.
23802382
assert!(do_unannounced_path_test(Some(21_000_000_0000_0000_000), 0, 21_000_000_0000_0000_000, 21_000_000_0000_0000_000).is_err());
23812383
}
23822384

23832385
#[test]
2384-
fn overflow_unannounced_path_test_b() {
2385-
// This tests for the same case as above, but with a slightly different codepath.
2386+
fn overflow_unannounced_path_test_feerate_overflow() {
2387+
// This tests for the same case as above, except instead of hitting a subtraction
2388+
// underflow, we hit a case where the fee charged at a hop overflowed.
23862389
assert!(do_unannounced_path_test(Some(21_000_000_0000_0000_000), 50000, 21_000_000_0000_0000_000, 21_000_000_0000_0000_000).is_err());
23872390
}
23882391

0 commit comments

Comments
 (0)