Skip to content

Commit b6c726d

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 90fb6dc commit b6c726d

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
@@ -638,7 +638,8 @@ mod tests {
638638

639639
#[test]
640640
fn payment_leases_roundtrip() {
641-
let lease = lease(2, 48, 100, Some(1_000), now_secs() + MIN_LEASE_REMAINING_SECS + 60);
641+
let lease =
642+
lease(2, 48, 100, Some(1_000), now_secs() + MIN_CACHED_LEASE_REMAINING_SECS + 60);
642643

643644
let encoded = lease.encode();
644645
let decoded = PaymentLease::read(&mut &encoded[..]).unwrap();
@@ -648,16 +649,16 @@ mod tests {
648649

649650
#[test]
650651
fn fixed_and_variable_lease_pools_are_isolated() {
651-
let valid_until = now_secs() + MIN_LEASE_REMAINING_SECS + 60;
652+
let valid_until = now_secs() + MIN_CACHED_LEASE_REMAINING_SECS + 60;
652653
let fixed = lease(2, 49, 100, Some(1_000), valid_until);
653654
let variable = lease(3, 50, 50, None, valid_until);
654655
let mut state = LSPS2LeaseState::from_leases(vec![fixed.clone(), variable.clone()]);
655656

656-
let (selected_fixed, _) = state.fixed_amount(1_000, None).unwrap();
657+
let (selected_fixed, _) = state.fixed_amount(1_000, None, 1).unwrap();
657658
assert_eq!(selected_fixed.id, fixed.id);
658-
assert!(state.fixed_amount(1_000, None).is_none());
659+
assert!(state.fixed_amount(1_000, None, 1).is_none());
659660

660-
let (selected_variable, _) = state.variable_amount(None, None).unwrap();
661+
let (selected_variable, _) = state.variable_amount(None, None, 1).unwrap();
661662
assert_eq!(selected_variable.id, variable.id);
662663
}
663664

0 commit comments

Comments
 (0)