Skip to content

Commit 4a23329

Browse files
committed
f Update cached lease state tests
Use the cache-specific validity threshold and pass the requested lifetime through the lease-selection tests after the validity policies were separated. Co-Authored-By: HAL 9000
1 parent 703a43b commit 4a23329

1 file changed

Lines changed: 6 additions & 5 deletions

File tree

src/liquidity/client/lsps2/state.rs

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -656,7 +656,8 @@ mod tests {
656656

657657
#[test]
658658
fn payment_leases_roundtrip() {
659-
let lease = lease(2, 48, 100, Some(1_000), now_secs() + MIN_LEASE_REMAINING_SECS + 60);
659+
let lease =
660+
lease(2, 48, 100, Some(1_000), now_secs() + MIN_CACHED_LEASE_REMAINING_SECS + 60);
660661

661662
let encoded = lease.encode();
662663
let decoded = PaymentLease::read(&mut &encoded[..]).unwrap();
@@ -666,16 +667,16 @@ mod tests {
666667

667668
#[test]
668669
fn fixed_and_variable_lease_pools_are_isolated() {
669-
let valid_until = now_secs() + MIN_LEASE_REMAINING_SECS + 60;
670+
let valid_until = now_secs() + MIN_CACHED_LEASE_REMAINING_SECS + 60;
670671
let fixed = lease(2, 49, 100, Some(1_000), valid_until);
671672
let variable = lease(3, 50, 50, None, valid_until);
672673
let mut state = LSPS2LeaseState::from_leases(vec![fixed.clone(), variable.clone()]);
673674

674-
let (selected_fixed, _) = state.fixed_amount(1_000, None).unwrap();
675+
let (selected_fixed, _) = state.fixed_amount(1_000, None, 1).unwrap();
675676
assert_eq!(selected_fixed.id, fixed.id);
676-
assert!(state.fixed_amount(1_000, None).is_none());
677+
assert!(state.fixed_amount(1_000, None, 1).is_none());
677678

678-
let (selected_variable, _) = state.variable_amount(None, None).unwrap();
679+
let (selected_variable, _) = state.variable_amount(None, None, 1).unwrap();
679680
assert_eq!(selected_variable.id, variable.id);
680681
}
681682

0 commit comments

Comments
 (0)