Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion fuzz/src/bolt11_deser.rs
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ pub fn do_test<Out: test_logger::Output>(data: &[u8], _out: Out) {
};

if let Ok(invoice) = Bolt11Invoice::from_signed(signed_raw_invoice) {
invoice.amount_milli_satoshis();
invoice.amount();
}
}
}
Expand Down
9 changes: 8 additions & 1 deletion lightning-background-processor/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2604,7 +2604,14 @@ mod tests {
($node_a: expr, $node_b: expr, $channel_value: expr) => {{
$node_a
.node
.create_channel($node_b.node.get_our_node_id(), $channel_value, 100, 42, None, None)
.create_channel(
$node_b.node.get_our_node_id(),
$channel_value,
lightning::types::amount::LightningAmount::from_msat(100),
42,
None,
None,
)
.unwrap();
let msg_a = get_event_msg!(
$node_a,
Expand Down
27 changes: 15 additions & 12 deletions lightning-invoice/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,8 @@ use core::time::Duration;
#[cfg(feature = "serde")]
use serde::{de::Error, Deserialize, Deserializer, Serialize, Serializer};

#[doc(no_inline)]
pub use lightning_types::amount::LightningAmount;
#[doc(no_inline)]
pub use lightning_types::payment::{PaymentHash, PaymentSecret};
#[doc(no_inline)]
Expand Down Expand Up @@ -672,10 +674,11 @@ impl<D: tb::Bool, H: tb::Bool, T: tb::Bool, C: tb::Bool, S: tb::Bool, M: tb::Boo
}
}

/// Sets the amount in millisatoshis. The optimal SI prefix is chosen automatically.
pub fn amount_milli_satoshis(mut self, amount_msat: u64) -> Self {
/// Sets the amount as a [`LightningAmount`]. The optimal SI prefix is chosen automatically.
pub fn amount(mut self, amount: LightningAmount) -> Self {
let amount_msat = amount.to_msat();
// Invoices are denominated in "pico BTC"
let amount = match amount_msat.checked_mul(10) {
let pico_btc = match amount_msat.checked_mul(10) {
Some(amt) => amt,
None => {
self.error = Some(CreationError::InvalidAmount);
Expand All @@ -684,9 +687,9 @@ impl<D: tb::Bool, H: tb::Bool, T: tb::Bool, C: tb::Bool, S: tb::Bool, M: tb::Boo
};
let biggest_possible_si_prefix = SiPrefix::values_desc()
.iter()
.find(|prefix| amount % prefix.multiplier() == 0)
.find(|prefix| pico_btc % prefix.multiplier() == 0)
.expect("Pico should always match");
self.amount = Some(amount / biggest_possible_si_prefix.multiplier());
self.amount = Some(pico_btc / biggest_possible_si_prefix.multiplier());
self.si_prefix = Some(*biggest_possible_si_prefix);
self
}
Expand Down Expand Up @@ -1631,9 +1634,9 @@ impl Bolt11Invoice {
self.signed_invoice.currency().into()
}

/// Returns the amount if specified in the invoice as millisatoshis.
pub fn amount_milli_satoshis(&self) -> Option<u64> {
self.signed_invoice.amount_pico_btc().map(|v| v / 10)
/// Returns the amount if specified in the invoice as a [`LightningAmount`].
pub fn amount(&self) -> Option<LightningAmount> {
self.signed_invoice.amount_pico_btc().map(|v| LightningAmount::from_msat(v / 10))
}

/// Returns the amount if specified in the invoice as pico BTC.
Expand Down Expand Up @@ -2190,12 +2193,12 @@ mod test {
.payment_hash(PaymentHash([0; 32]))
.duration_since_epoch(Duration::from_secs(1234567));

let invoice = builder.clone().amount_milli_satoshis(1500).build_raw().unwrap();
let invoice = builder.clone().amount(LightningAmount::from_msat(1500)).build_raw().unwrap();

assert_eq!(invoice.hrp.si_prefix, Some(SiPrefix::Nano));
assert_eq!(invoice.hrp.raw_amount, Some(15));

let invoice = builder.amount_milli_satoshis(150).build_raw().unwrap();
let invoice = builder.amount(LightningAmount::from_msat(150)).build_raw().unwrap();

assert_eq!(invoice.hrp.si_prefix, Some(SiPrefix::Pico));
assert_eq!(invoice.hrp.raw_amount, Some(1500));
Expand Down Expand Up @@ -2304,7 +2307,7 @@ mod test {
]);

let builder = InvoiceBuilder::new(Currency::BitcoinTestnet)
.amount_milli_satoshis(123)
.amount(LightningAmount::from_msat(123))
.duration_since_epoch(Duration::from_secs(1234567))
.payee_pub_key(public_key)
.expiry_time(Duration::from_secs(54321))
Expand All @@ -2325,7 +2328,7 @@ mod test {
assert!(invoice.check_signature().is_ok());
assert_eq!(invoice.tagged_fields().count(), 10);

assert_eq!(invoice.amount_milli_satoshis(), Some(123));
assert_eq!(invoice.amount(), Some(LightningAmount::from_msat(123)));
assert_eq!(invoice.amount_pico_btc(), Some(1230));
assert_eq!(invoice.currency(), Currency::BitcoinTestnet);
#[cfg(feature = "std")]
Expand Down
28 changes: 14 additions & 14 deletions lightning-invoice/tests/ser_de.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ fn get_test_tuples() -> Vec<(String, SignedRawBolt11Invoice, bool, bool)> {
(
"lnbc2500u1pvjluezsp5zyg3zyg3zyg3zyg3zyg3zyg3zyg3zyg3zyg3zyg3zyg3zyg3zygspp5qqqsyqcyq5rqwzqfqqqsyqcyq5rqwzqfqqqsyqcyq5rqwzqfqypqdq5xysxxatsyp3k7enxv4jsxqzpu9qrsgquk0rl77nj30yxdy8j9vdx85fkpmdla2087ne0xh8nhedh8w27kyke0lp53ut353s06fv3qfegext0eh0ymjpf39tuven09sam30g4vgpfna3rh".to_owned(),
InvoiceBuilder::new(Currency::Bitcoin)
.amount_milli_satoshis(250_000_000)
.amount(LightningAmount::from_msat(250_000_000))
.duration_since_epoch(Duration::from_secs(1496314658))
.payment_secret(PaymentSecret([0x11; 32]))
.payment_hash(lightning_invoice::PaymentHash(
Expand Down Expand Up @@ -70,7 +70,7 @@ fn get_test_tuples() -> Vec<(String, SignedRawBolt11Invoice, bool, bool)> {
(
"lnbc2500u1pvjluezsp5zyg3zyg3zyg3zyg3zyg3zyg3zyg3zyg3zyg3zyg3zyg3zyg3zygspp5qqqsyqcyq5rqwzqfqqqsyqcyq5rqwzqfqqqsyqcyq5rqwzqfqypqdpquwpc4curk03c9wlrswe78q4eyqc7d8d0xqzpu9qrsgqhtjpauu9ur7fw2thcl4y9vfvh4m9wlfyz2gem29g5ghe2aak2pm3ps8fdhtceqsaagty2vph7utlgj48u0ged6a337aewvraedendscp573dxr".to_owned(),
InvoiceBuilder::new(Currency::Bitcoin)
.amount_milli_satoshis(250_000_000)
.amount(LightningAmount::from_msat(250_000_000))
.duration_since_epoch(Duration::from_secs(1496314658))
.payment_secret(PaymentSecret([0x11; 32]))
.payment_hash(lightning_invoice::PaymentHash(
Expand Down Expand Up @@ -98,7 +98,7 @@ fn get_test_tuples() -> Vec<(String, SignedRawBolt11Invoice, bool, bool)> {
(
"lnbc20m1pvjluezsp5zyg3zyg3zyg3zyg3zyg3zyg3zyg3zyg3zyg3zyg3zyg3zyg3zygspp5qqqsyqcyq5rqwzqfqqqsyqcyq5rqwzqfqqqsyqcyq5rqwzqfqypqhp58yjmdan79s6qqdhdzgynm4zwqd5d7xmw5fk98klysy043l2ahrqs9qrsgq7ea976txfraylvgzuxs8kgcw23ezlrszfnh8r6qtfpr6cxga50aj6txm9rxrydzd06dfeawfk6swupvz4erwnyutnjq7x39ymw6j38gp7ynn44".to_owned(),
InvoiceBuilder::new(Currency::Bitcoin)
.amount_milli_satoshis(2_000_000_000)
.amount(LightningAmount::from_msat(2_000_000_000))
.duration_since_epoch(Duration::from_secs(1496314658))
.description_hash(sha256::Hash::hash(b"One piece of chocolate cake, one icecream cone, one pickle, one slice of swiss cheese, one slice of salami, one lollypop, one piece of cherry pie, one sausage, one cupcake, and one slice of watermelon"))
.payment_secret(PaymentSecret([0x11; 32]))
Expand All @@ -125,7 +125,7 @@ fn get_test_tuples() -> Vec<(String, SignedRawBolt11Invoice, bool, bool)> {
(
"lntb20m1pvjluezsp5zyg3zyg3zyg3zyg3zyg3zyg3zyg3zyg3zyg3zyg3zyg3zyg3zygshp58yjmdan79s6qqdhdzgynm4zwqd5d7xmw5fk98klysy043l2ahrqspp5qqqsyqcyq5rqwzqfqqqsyqcyq5rqwzqfqqqsyqcyq5rqwzqfqypqfpp3x9et2e20v6pu37c5d9vax37wxq72un989qrsgqdj545axuxtnfemtpwkc45hx9d2ft7x04mt8q7y6t0k2dge9e7h8kpy9p34ytyslj3yu569aalz2xdk8xkd7ltxqld94u8h2esmsmacgpghe9k8".to_owned(),
InvoiceBuilder::new(Currency::BitcoinTestnet)
.amount_milli_satoshis(2_000_000_000)
.amount(LightningAmount::from_msat(2_000_000_000))
.duration_since_epoch(Duration::from_secs(1496314658))
.description_hash(sha256::Hash::hash(b"One piece of chocolate cake, one icecream cone, one pickle, one slice of swiss cheese, one slice of salami, one lollypop, one piece of cherry pie, one sausage, one cupcake, and one slice of watermelon"))
.payment_secret(PaymentSecret([0x11; 32]))
Expand Down Expand Up @@ -153,7 +153,7 @@ fn get_test_tuples() -> Vec<(String, SignedRawBolt11Invoice, bool, bool)> {
(
"lnbc20m1pvjluezsp5zyg3zyg3zyg3zyg3zyg3zyg3zyg3zyg3zyg3zyg3zyg3zyg3zygspp5qqqsyqcyq5rqwzqfqqqsyqcyq5rqwzqfqqqsyqcyq5rqwzqfqypqhp58yjmdan79s6qqdhdzgynm4zwqd5d7xmw5fk98klysy043l2ahrqsfpp3qjmp7lwpagxun9pygexvgpjdc4jdj85fr9yq20q82gphp2nflc7jtzrcazrra7wwgzxqc8u7754cdlpfrmccae92qgzqvzq2ps8pqqqqqqpqqqqq9qqqvpeuqafqxu92d8lr6fvg0r5gv0heeeqgcrqlnm6jhphu9y00rrhy4grqszsvpcgpy9qqqqqqgqqqqq7qqzq9qrsgqdfjcdk6w3ak5pca9hwfwfh63zrrz06wwfya0ydlzpgzxkn5xagsqz7x9j4jwe7yj7vaf2k9lqsdk45kts2fd0fkr28am0u4w95tt2nsq76cqw0".to_owned(),
InvoiceBuilder::new(Currency::Bitcoin)
.amount_milli_satoshis(2_000_000_000)
.amount(LightningAmount::from_msat(2_000_000_000))
.duration_since_epoch(Duration::from_secs(1496314658))
.description_hash(sha256::Hash::hash(b"One piece of chocolate cake, one icecream cone, one pickle, one slice of swiss cheese, one slice of salami, one lollypop, one piece of cherry pie, one sausage, one cupcake, and one slice of watermelon"))
.payment_secret(PaymentSecret([0x11; 32]))
Expand Down Expand Up @@ -198,7 +198,7 @@ fn get_test_tuples() -> Vec<(String, SignedRawBolt11Invoice, bool, bool)> {
(
"lnbc20m1pvjluezsp5zyg3zyg3zyg3zyg3zyg3zyg3zyg3zyg3zyg3zyg3zyg3zyg3zygshp58yjmdan79s6qqdhdzgynm4zwqd5d7xmw5fk98klysy043l2ahrqspp5qqqsyqcyq5rqwzqfqqqsyqcyq5rqwzqfqqqsyqcyq5rqwzqfqypqfppj3a24vwu6r8ejrss3axul8rxldph2q7z99qrsgqz6qsgww34xlatfj6e3sngrwfy3ytkt29d2qttr8qz2mnedfqysuqypgqex4haa2h8fx3wnypranf3pdwyluftwe680jjcfp438u82xqphf75ym".to_owned(),
InvoiceBuilder::new(Currency::Bitcoin)
.amount_milli_satoshis(2_000_000_000)
.amount(LightningAmount::from_msat(2_000_000_000))
.duration_since_epoch(Duration::from_secs(1496314658))
.description_hash(sha256::Hash::hash(b"One piece of chocolate cake, one icecream cone, one pickle, one slice of swiss cheese, one slice of salami, one lollypop, one piece of cherry pie, one sausage, one cupcake, and one slice of watermelon"))
.payment_secret(PaymentSecret([0x11; 32]))
Expand Down Expand Up @@ -226,7 +226,7 @@ fn get_test_tuples() -> Vec<(String, SignedRawBolt11Invoice, bool, bool)> {
(
"lnbc20m1pvjluezsp5zyg3zyg3zyg3zyg3zyg3zyg3zyg3zyg3zyg3zyg3zyg3zyg3zygshp58yjmdan79s6qqdhdzgynm4zwqd5d7xmw5fk98klysy043l2ahrqspp5qqqsyqcyq5rqwzqfqqqsyqcyq5rqwzqfqqqsyqcyq5rqwzqfqypqfppqw508d6qejxtdg4y5r3zarvary0c5xw7k9qrsgqt29a0wturnys2hhxpner2e3plp6jyj8qx7548zr2z7ptgjjc7hljm98xhjym0dg52sdrvqamxdezkmqg4gdrvwwnf0kv2jdfnl4xatsqmrnsse".to_owned(),
InvoiceBuilder::new(Currency::Bitcoin)
.amount_milli_satoshis(2_000_000_000)
.amount(LightningAmount::from_msat(2_000_000_000))
.duration_since_epoch(Duration::from_secs(1496314658))
.description_hash(sha256::Hash::hash(b"One piece of chocolate cake, one icecream cone, one pickle, one slice of swiss cheese, one slice of salami, one lollypop, one piece of cherry pie, one sausage, one cupcake, and one slice of watermelon"))
.payment_secret(PaymentSecret([0x11; 32]))
Expand Down Expand Up @@ -256,7 +256,7 @@ fn get_test_tuples() -> Vec<(String, SignedRawBolt11Invoice, bool, bool)> {
(
"lnbc20m1pvjluezsp5zyg3zyg3zyg3zyg3zyg3zyg3zyg3zyg3zyg3zyg3zyg3zyg3zygshp58yjmdan79s6qqdhdzgynm4zwqd5d7xmw5fk98klysy043l2ahrqspp5qqqsyqcyq5rqwzqfqqqsyqcyq5rqwzqfqqqsyqcyq5rqwzqfqypqfp4qrp33g0q5c5txsp9arysrx4k6zdkfs4nce4xj0gdcccefvpysxf3q9qrsgq9vlvyj8cqvq6ggvpwd53jncp9nwc47xlrsnenq2zp70fq83qlgesn4u3uyf4tesfkkwwfg3qs54qe426hp3tz7z6sweqdjg05axsrjqp9yrrwc".to_owned(),
InvoiceBuilder::new(Currency::Bitcoin)
.amount_milli_satoshis(2_000_000_000)
.amount(LightningAmount::from_msat(2_000_000_000))
.duration_since_epoch(Duration::from_secs(1496314658))
.description_hash(sha256::Hash::hash(b"One piece of chocolate cake, one icecream cone, one pickle, one slice of swiss cheese, one slice of salami, one lollypop, one piece of cherry pie, one sausage, one cupcake, and one slice of watermelon"))
.payment_secret(PaymentSecret([0x11; 32]))
Expand Down Expand Up @@ -286,7 +286,7 @@ fn get_test_tuples() -> Vec<(String, SignedRawBolt11Invoice, bool, bool)> {
(
"lnbc9678785340p1pwmna7lpp5gc3xfm08u9qy06djf8dfflhugl6p7lgza6dsjxq454gxhj9t7a0sd8dgfkx7cmtwd68yetpd5s9xar0wfjn5gpc8qhrsdfq24f5ggrxdaezqsnvda3kkum5wfjkzmfqf3jkgem9wgsyuctwdus9xgrcyqcjcgpzgfskx6eqf9hzqnteypzxz7fzypfhg6trddjhygrcyqezcgpzfysywmm5ypxxjemgw3hxjmn8yptk7untd9hxwg3q2d6xjcmtv4ezq7pqxgsxzmnyyqcjqmt0wfjjq6t5v4khxsp5zyg3zyg3zyg3zyg3zyg3zyg3zyg3zyg3zyg3zyg3zyg3zyg3zygsxqyjw5qcqp2rzjq0gxwkzc8w6323m55m4jyxcjwmy7stt9hwkwe2qxmy8zpsgg7jcuwz87fcqqeuqqqyqqqqlgqqqqn3qq9q9qrsgqrvgkpnmps664wgkp43l22qsgdw4ve24aca4nymnxddlnp8vh9v2sdxlu5ywdxefsfvm0fq3sesf08uf6q9a2ke0hc9j6z6wlxg5z5kqpu2v9wz".to_owned(),
InvoiceBuilder::new(Currency::Bitcoin)
.amount_milli_satoshis(967878534)
.amount(LightningAmount::from_msat(967878534))
.duration_since_epoch(Duration::from_secs(1572468703))
.payment_secret(PaymentSecret([0x11; 32]))
.payment_hash(lightning_invoice::PaymentHash(
Expand Down Expand Up @@ -324,7 +324,7 @@ fn get_test_tuples() -> Vec<(String, SignedRawBolt11Invoice, bool, bool)> {
(
"lnbc25m1pvjluezpp5qqqsyqcyq5rqwzqfqqqsyqcyq5rqwzqfqqqsyqcyq5rqwzqfqypqdq5vdhkven9v5sxyetpdeessp5zyg3zyg3zyg3zyg3zyg3zyg3zyg3zyg3zyg3zyg3zyg3zyg3zygs9q5sqqqqqqqqqqqqqqqqsgq2a25dxl5hrntdtn6zvydt7d66hyzsyhqs4wdynavys42xgl6sgx9c4g7me86a27t07mdtfry458rtjr0v92cnmswpsjscgt2vcse3sgpz3uapa".to_owned(),
InvoiceBuilder::new(Currency::Bitcoin)
.amount_milli_satoshis(2_500_000_000)
.amount(LightningAmount::from_msat(2_500_000_000))
.duration_since_epoch(Duration::from_secs(1496314658))
.payment_secret(PaymentSecret([0x11; 32]))
.payment_hash(lightning_invoice::PaymentHash(
Expand All @@ -351,7 +351,7 @@ fn get_test_tuples() -> Vec<(String, SignedRawBolt11Invoice, bool, bool)> {
(
"LNBC25M1PVJLUEZPP5QQQSYQCYQ5RQWZQFQQQSYQCYQ5RQWZQFQQQSYQCYQ5RQWZQFQYPQDQ5VDHKVEN9V5SXYETPDEESSP5ZYG3ZYG3ZYG3ZYG3ZYG3ZYG3ZYG3ZYG3ZYG3ZYG3ZYG3ZYG3ZYGS9Q5SQQQQQQQQQQQQQQQQSGQ2A25DXL5HRNTDTN6ZVYDT7D66HYZSYHQS4WDYNAVYS42XGL6SGX9C4G7ME86A27T07MDTFRY458RTJR0V92CNMSWPSJSCGT2VCSE3SGPZ3UAPA".to_owned(),
InvoiceBuilder::new(Currency::Bitcoin)
.amount_milli_satoshis(2_500_000_000)
.amount(LightningAmount::from_msat(2_500_000_000))
.duration_since_epoch(Duration::from_secs(1496314658))
.payment_secret(PaymentSecret([0x11; 32]))
.payment_hash(lightning_invoice::PaymentHash(
Expand All @@ -378,7 +378,7 @@ fn get_test_tuples() -> Vec<(String, SignedRawBolt11Invoice, bool, bool)> {
(
"lnbc25m1pvjluezpp5qqqsyqcyq5rqwzqfqqqsyqcyq5rqwzqfqqqsyqcyq5rqwzqfqypqdq5vdhkven9v5sxyetpdeessp5zyg3zyg3zyg3zyg3zyg3zyg3zyg3zyg3zyg3zyg3zyg3zyg3zygs9q5sqqqqqqqqqqqqqqqqsgq2qrqqqfppnqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqppnqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqpp4qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqhpnqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqhp4qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqspnqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqsp4qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqnp5qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqnpkqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqz599y53s3ujmcfjp5xrdap68qxymkqphwsexhmhr8wdz5usdzkzrse33chw6dlp3jhuhge9ley7j2ayx36kawe7kmgg8sv5ugdyusdcqzn8z9x".to_owned(),
InvoiceBuilder::new(Currency::Bitcoin)
.amount_milli_satoshis(2_500_000_000)
.amount(LightningAmount::from_msat(2_500_000_000))
.duration_since_epoch(Duration::from_secs(1496314658))
.payment_secret(PaymentSecret([0x11; 32]))
.payment_hash(lightning_invoice::PaymentHash(
Expand All @@ -405,7 +405,7 @@ fn get_test_tuples() -> Vec<(String, SignedRawBolt11Invoice, bool, bool)> {
( // Older version of the payment metadata test with a payment_pubkey set
"lnbc10m1pvjluezpp5qqqsyqcyq5rqwzqfqqqsyqcyq5rqwzqfqqqsyqcyq5rqwzqfqypqdp9wpshjmt9de6zqmt9w3skgct5vysxjmnnd9jx2mq8q8a04uqnp4q0n326hr8v9zprg8gsvezcch06gfaqqhde2aj730yg0durunfhv66sp5zyg3zyg3zyg3zyg3zyg3zyg3zyg3zyg3zyg3zyg3zyg3zyg3zygs9q2gqqqqqqsgqy9gw6ymamd20jumvdgpfphkhp8fzhhdhycw36egcmla5vlrtrmhs9t7psfy3hkkdqzm9eq64fjg558znccds5nhsfmxveha5xe0dykgpspdha0".to_owned(),
InvoiceBuilder::new(Currency::Bitcoin)
.amount_milli_satoshis(1_000_000_000)
.amount(LightningAmount::from_msat(1_000_000_000))
.duration_since_epoch(Duration::from_secs(1496314658))
.payment_hash(lightning_invoice::PaymentHash(
<[u8; 32]>::try_from(
Expand Down Expand Up @@ -437,7 +437,7 @@ fn get_test_tuples() -> Vec<(String, SignedRawBolt11Invoice, bool, bool)> {
(
"lnbc10m1pvjluezpp5qqqsyqcyq5rqwzqfqqqsyqcyq5rqwzqfqqqsyqcyq5rqwzqfqypqdp9wpshjmt9de6zqmt9w3skgct5vysxjmnnd9jx2mq8q8a04uqsp5zyg3zyg3zyg3zyg3zyg3zyg3zyg3zyg3zyg3zyg3zyg3zyg3zygs9q2gqqqqqqsgq7hf8he7ecf7n4ffphs6awl9t6676rrclv9ckg3d3ncn7fct63p6s365duk5wrk202cfy3aj5xnnp5gs3vrdvruverwwq7yzhkf5a3xqpd05wjc".to_owned(),
InvoiceBuilder::new(Currency::Bitcoin)
.amount_milli_satoshis(1_000_000_000)
.amount(LightningAmount::from_msat(1_000_000_000))
.duration_since_epoch(Duration::from_secs(1496314658))
.payment_hash(lightning_invoice::PaymentHash(
<[u8; 32]>::try_from(
Expand Down
7 changes: 4 additions & 3 deletions lightning-liquidity/tests/lsps2_integration_tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ use lightning::util::errors::APIError;
use lightning::util::logger::Logger;
use lightning::util::test_utils::{TestBroadcaster, TestStore};

use lightning_invoice::{Bolt11Invoice, InvoiceBuilder, RoutingFees};
use lightning_invoice::{Bolt11Invoice, InvoiceBuilder, LightningAmount, RoutingFees};

use lightning_types::payment::PaymentHash;

Expand Down Expand Up @@ -147,7 +147,8 @@ fn create_jit_invoice(
.private_route(route_hint);

if let Some(amount_msat) = payment_size_msat {
invoice_builder = invoice_builder.amount_milli_satoshis(amount_msat).basic_mpp();
invoice_builder =
invoice_builder.amount(LightningAmount::from_msat(amount_msat)).basic_mpp();
}

let raw_invoice = invoice_builder.build_raw().map_err(|e| {
Expand Down Expand Up @@ -1496,7 +1497,7 @@ fn create_channel_with_manual_broadcast(
.create_channel(
*client_node_id,
*expected_outbound_amount_msat,
0,
LightningAmount::from_msat(0),
user_channel_id,
None,
None
Expand Down
Loading
Loading