Skip to content

Commit 1de7279

Browse files
committed
f - use MAX_SHORT_LIVED_RELATIVE_EXPIRY in tests
1 parent 2149018 commit 1de7279

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

lightning/src/ln/offers_tests.rs

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ use core::time::Duration;
4646
use crate::blinded_path::{BlindedPath, IntroductionNode};
4747
use crate::blinded_path::payment::{Bolt12OfferContext, Bolt12RefundContext, PaymentContext};
4848
use crate::events::{Event, MessageSendEventsProvider, PaymentPurpose};
49-
use crate::ln::channelmanager::{PaymentId, RecentPaymentDetails, Retry, self};
49+
use crate::ln::channelmanager::{MAX_SHORT_LIVED_RELATIVE_EXPIRY, PaymentId, RecentPaymentDetails, Retry, self};
5050
use crate::ln::functional_test_utils::*;
5151
use crate::ln::msgs::{ChannelMessageHandler, Init, NodeAnnouncement, OnionMessage, OnionMessageHandler, RoutingMessageHandler, SocketAddress, UnsignedGossipMessage, UnsignedNodeAnnouncement};
5252
use crate::offers::invoice::Bolt12Invoice;
@@ -366,7 +366,7 @@ fn creates_short_lived_offer() {
366366
let alice_id = alice.node.get_our_node_id();
367367
let bob = &nodes[1];
368368

369-
let absolute_expiry = alice.node.duration_since_epoch() + Duration::from_secs(60 * 60 * 24);
369+
let absolute_expiry = alice.node.duration_since_epoch() + MAX_SHORT_LIVED_RELATIVE_EXPIRY;
370370
let offer = alice.node
371371
.create_offer_builder(Some(absolute_expiry)).unwrap()
372372
.build().unwrap();
@@ -392,9 +392,11 @@ fn creates_long_lived_offer() {
392392
let alice = &nodes[0];
393393
let alice_id = alice.node.get_our_node_id();
394394

395-
let absolute_expiry = alice.node.duration_since_epoch() + Duration::from_secs(60 * 60 * 25);
395+
let absolute_expiry = alice.node.duration_since_epoch() + MAX_SHORT_LIVED_RELATIVE_EXPIRY
396+
+ Duration::from_secs(1);
396397
let offer = alice.node
397-
.create_offer_builder(Some(absolute_expiry)).unwrap()
398+
.create_offer_builder(Some(absolute_expiry))
399+
.unwrap()
398400
.build().unwrap();
399401
assert_eq!(offer.absolute_expiry(), Some(absolute_expiry));
400402
assert!(!offer.paths().is_empty());
@@ -426,7 +428,7 @@ fn creates_short_lived_refund() {
426428
let bob = &nodes[1];
427429
let bob_id = bob.node.get_our_node_id();
428430

429-
let absolute_expiry = bob.node.duration_since_epoch() + Duration::from_secs(60 * 60 * 24);
431+
let absolute_expiry = bob.node.duration_since_epoch() + MAX_SHORT_LIVED_RELATIVE_EXPIRY;
430432
let payment_id = PaymentId([1; 32]);
431433
let refund = bob.node
432434
.create_refund_builder(10_000_000, absolute_expiry, payment_id, Retry::Attempts(0), None)
@@ -454,7 +456,8 @@ fn creates_long_lived_refund() {
454456
let bob = &nodes[1];
455457
let bob_id = bob.node.get_our_node_id();
456458

457-
let absolute_expiry = bob.node.duration_since_epoch() + Duration::from_secs(60 * 60 * 25);
459+
let absolute_expiry = bob.node.duration_since_epoch() + MAX_SHORT_LIVED_RELATIVE_EXPIRY
460+
+ Duration::from_secs(1);
458461
let payment_id = PaymentId([1; 32]);
459462
let refund = bob.node
460463
.create_refund_builder(10_000_000, absolute_expiry, payment_id, Retry::Attempts(0), None)

0 commit comments

Comments
 (0)