Skip to content

Commit 8551f5f

Browse files
committed
Tweak offer_tests to bypass liquidity check
Modify tests to bypass liquidity check by giving the offer a denomination in fiat. In turn, making amount() and build_uchecked() pub(crate)s.
1 parent 6da192b commit 8551f5f

File tree

2 files changed

+9
-7
lines changed

2 files changed

+9
-7
lines changed

lightning/src/ln/offers_tests.rs

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@ use crate::offers::invoice_error::InvoiceError;
5555
use crate::offers::invoice_request::{InvoiceRequest, InvoiceRequestFields};
5656
use crate::offers::parse::Bolt12SemanticError;
5757
use crate::onion_message::messenger::{Destination, PeeledOnion};
58+
use crate::offers::offer::Amount;
5859
use crate::onion_message::offers::OffersMessage;
5960
use crate::onion_message::packet::ParsedOnionMessageContents;
6061
use crate::routing::gossip::{NodeAlias, NodeId};
@@ -1607,9 +1608,9 @@ fn fails_creating_or_paying_for_offer_without_connected_peers() {
16071608
reconnect_nodes(args);
16081609

16091610
let offer = alice.node
1610-
.create_offer_builder(Some(absolute_expiry)).unwrap()
1611-
.amount_msats(10_000_000)
1612-
.build().unwrap();
1611+
.create_offer_builder(None).unwrap()
1612+
.amount(Amount::Currency {iso4217_code: *b"USD", amount: 6_000})
1613+
.build_unchecked();
16131614

16141615
let payment_id = PaymentId([1; 32]);
16151616

@@ -1771,8 +1772,9 @@ fn fails_creating_invoice_request_without_blinded_reply_path() {
17711772

17721773
let offer = alice.node
17731774
.create_offer_builder(None).unwrap()
1774-
.amount_msats(10_000_000)
1775-
.build().unwrap();
1775+
.amount(Amount::Currency {iso4217_code: *b"USD", amount: 6_000})
1776+
.build_unchecked();
1777+
17761778

17771779
let payment_id = PaymentId([1; 32]);
17781780

lightning/src/offers/offer.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -310,7 +310,7 @@ macro_rules! offer_builder_methods { (
310310
/// Sets the [`Offer::amount`].
311311
///
312312
/// Successive calls to this method will override the previous setting.
313-
pub(super) fn amount($($self_mut)* $self: $self_type, amount: Amount) -> $return_type {
313+
pub(crate) fn amount($($self_mut)* $self: $self_type, amount: Amount) -> $return_type {
314314
$self.offer.amount = Some(amount);
315315
$return_value
316316
}
@@ -460,7 +460,7 @@ macro_rules! offer_builder_test_methods { (
460460
}
461461

462462
#[cfg_attr(c_bindings, allow(dead_code))]
463-
pub(super) fn build_unchecked($self: $self_type) -> Offer {
463+
pub(crate) fn build_unchecked($self: $self_type) -> Offer {
464464
$self.build_without_checks()
465465
}
466466
} }

0 commit comments

Comments
 (0)