From 546035032d15a01802c3dffc886101ffc02ffe25 Mon Sep 17 00:00:00 2001 From: Gabriel Comte Date: Thu, 25 May 2023 17:40:56 +0200 Subject: [PATCH 01/11] Set mpp flag in invoices --- eel/src/invoice.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/eel/src/invoice.rs b/eel/src/invoice.rs index 3bbef502..d168b9db 100644 --- a/eel/src/invoice.rs +++ b/eel/src/invoice.rs @@ -153,7 +153,8 @@ pub(crate) async fn create_invoice( .amount_milli_satoshis(amount_msat) .current_timestamp() .expiry_time(Duration::from_secs(10 * 60)) - .min_final_cltv_expiry_delta(144); + .min_final_cltv_expiry_delta(144) + .basic_mpp(); for private_route in private_routes { builder = builder.private_route(private_route); } From 9b6bcbf7d9410e76ace7dee3705102b06104a2dc Mon Sep 17 00:00:00 2001 From: Gabriel Comte Date: Fri, 26 May 2023 14:49:46 +0200 Subject: [PATCH 02/11] Test receiving MPP --- eel/tests/receiving_payments_test.rs | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/eel/tests/receiving_payments_test.rs b/eel/tests/receiving_payments_test.rs index 46f86e82..fa77f39f 100644 --- a/eel/tests/receiving_payments_test.rs +++ b/eel/tests/receiving_payments_test.rs @@ -22,7 +22,10 @@ mod receiving_payments_test { const TWO_K_SATS: u64 = 2_000_000; const TEN_K_SATS: u64 = 10_000_000; const TWENTY_K_SATS: u64 = 20_000_000; + const TWO_HUNDRED_K_SATS: u64 = 200_000_000; const HALF_M_SATS: u64 = 500_000_000; + const ONE_M_SATS: u64 = 1_000_000_000; + const TWO_M_SATS: u64 = 2_000_000_000; // The amount of sats the LSP provides to the user as inbound capacity. // See https://github.com/getlipa/lipa-lightning-lib/blob/b821162df982799c497e083e9707aa421aee43a8/lspd/compose.yaml#LL63C44-L63C46 @@ -164,14 +167,27 @@ mod receiving_payments_test { // Add 2M sats of inbound capacity - More than the max allowed receive amount let node_id = node.get_node_info().node_pubkey.to_hex(); + assert_eq!(nigiri::get_number_of_txs_in_mempool(), Ok::(2)); // 2 times jit channel open flow let _ = nigiri::lnd_node_open_channel(NodeInstance::LspdLnd, &node_id, false).unwrap(); // 1M sats let _ = nigiri::lnd_node_open_channel(NodeInstance::LspdLnd, &node_id, false).unwrap(); // 1M sats + wait_for_eq!(nigiri::get_number_of_txs_in_mempool(), Ok::(4)); try_cmd_repeatedly!(nigiri::mine_blocks, N_RETRIES, HALF_SEC, 10); - wait_for!(node.get_node_info().channels_info.inbound_capacity_msat > 2_000_000_000); + wait_for!(node.get_node_info().channels_info.inbound_capacity_msat > TWO_M_SATS); assert_high_inbound_capacity(&node); - // todo also test multipath payments + // test receiving MPP + let inbound_capacity = node.get_node_info().channels_info.inbound_capacity_msat; + let payment_amount = inbound_capacity - TWO_HUNDRED_K_SATS; // todo use full inbound capacity as soon as the number is accurate + assert!(payment_amount > ONE_M_SATS); // Biggest channel is 1M sats; This payment involves transferring through more than 1 channel + let invoice = issue_invoice( + &node, + node.get_node_info().channels_info.inbound_capacity_msat - TWO_HUNDRED_K_SATS, + ); + + wait_for!(nigiri::lnd_pay_invoice(NodeInstance::LspdLnd, &invoice).is_ok()); + + assert!(node.get_node_info().channels_info.local_balance_msat > TWO_M_SATS); } } From 1fb4851c5c63ce0736f419f2cbc442a8d8462adb Mon Sep 17 00:00:00 2001 From: Gabriel Comte Date: Fri, 26 May 2023 18:33:43 +0200 Subject: [PATCH 03/11] Wait for TXs to be in mempool before mining --- eel/tests/setup_env/mod.rs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/eel/tests/setup_env/mod.rs b/eel/tests/setup_env/mod.rs index 7a4b48a7..a9c7e70a 100644 --- a/eel/tests/setup_env/mod.rs +++ b/eel/tests/setup_env/mod.rs @@ -754,7 +754,12 @@ pub mod nigiri { } pub fn initiate_channel_from_remote(node_pubkey: PublicKey, remote_node: NodeInstance) { + let txs_before = get_number_of_txs_in_mempool().unwrap(); lnd_node_open_channel(remote_node, &node_pubkey.to_hex(), false).unwrap(); + wait_for_eq!( + nigiri::get_number_of_txs_in_mempool(), + Ok::(txs_before + 1) + ); try_cmd_repeatedly!(nigiri::mine_blocks, N_RETRIES, HALF_SEC, 10); wait_for!(is_channel_confirmed(remote_node, &node_pubkey.to_hex())); From 730741bdb67a4a28ce0e8418f6cefc0aec9d1019 Mon Sep 17 00:00:00 2001 From: Gabriel Comte Date: Fri, 26 May 2023 18:37:18 +0200 Subject: [PATCH 04/11] Test sending MPP --- eel/tests/sending_payments_test.rs | 73 ++++++++++++++++++++++++------ 1 file changed, 60 insertions(+), 13 deletions(-) diff --git a/eel/tests/sending_payments_test.rs b/eel/tests/sending_payments_test.rs index 69566eba..cbb2af9c 100644 --- a/eel/tests/sending_payments_test.rs +++ b/eel/tests/sending_payments_test.rs @@ -12,9 +12,17 @@ mod sending_payments_test { use crate::setup::{mocked_storage_node, setup_outbound_capacity}; use crate::setup_env::nigiri; use crate::setup_env::nigiri::NodeInstance::{LspdLnd, NigiriCln, NigiriLnd}; - use crate::wait_for_eq; + use crate::{wait_for, wait_for_eq}; - const PAYMENT_AMOUNT: u64 = 1_000_000; + const SECONDS_IN_AN_HOUR: u64 = 3600; + const DESCRIPTION_SAMPLE: &str = "Luke, I Am Your Father"; + + const THOUSAND_SATS: u64 = 1_000_000; + const FIFE_K_SATS: u64 = 5_000_000; + const FOURTY_K_SATS: u64 = 40_000_000; + const NINE_HUNDRED_K_SATS: u64 = 900_000_000; + const ONE_M_SATS: u64 = 1_000_000_000; + const MORE_THAN_ONE_M_SATS: u64 = 1_500_000_000; #[test] #[file_serial(key, "/tmp/3l-int-tests-lock")] @@ -25,7 +33,7 @@ mod sending_payments_test { setup_outbound_capacity(&node); // Test vanilla payment - let invoice = nigiri::issue_invoice(LspdLnd, "test", PAYMENT_AMOUNT, 3600).unwrap(); + let invoice = nigiri::issue_invoice(LspdLnd, "test", FIFE_K_SATS, 3600).unwrap(); let initial_balance = nigiri::query_node_balance(LspdLnd).unwrap(); @@ -33,7 +41,7 @@ mod sending_payments_test { wait_for_eq!( nigiri::query_node_balance(LspdLnd).unwrap() - initial_balance, - PAYMENT_AMOUNT + FIFE_K_SATS ); // Test a regular payment but using an invoice that has no amount specified @@ -61,12 +69,12 @@ mod sending_payments_test { let initial_balance = nigiri::query_node_balance(LspdLnd).unwrap(); - node.pay_open_invoice(invoice, PAYMENT_AMOUNT, String::new()) + node.pay_open_invoice(invoice, FIFE_K_SATS, String::new()) .unwrap(); wait_for_eq!( nigiri::query_node_balance(LspdLnd).unwrap() - initial_balance, - PAYMENT_AMOUNT + FIFE_K_SATS ); // Test paying open invoices specifying 0 as the payment amount @@ -89,11 +97,11 @@ mod sending_payments_test { ); // Test paying open invoices using an invoice with a specified amount - let invoice = nigiri::issue_invoice(LspdLnd, "test", PAYMENT_AMOUNT, 3600).unwrap(); + let invoice = nigiri::issue_invoice(LspdLnd, "test", FIFE_K_SATS, 3600).unwrap(); let initial_balance = nigiri::query_node_balance(LspdLnd).unwrap(); - let payment_result = node.pay_open_invoice(invoice, PAYMENT_AMOUNT, String::new()); + let payment_result = node.pay_open_invoice(invoice, FIFE_K_SATS, String::new()); assert!(matches!( payment_result, Err(perro::Error::InvalidInput { .. }) @@ -106,12 +114,51 @@ mod sending_payments_test { nigiri::query_node_balance(LspdLnd).unwrap() ); - // todo also test multipath payments - } + // test sending mpp + let channels_info = node.get_node_info().channels_info; + assert_eq!(channels_info.num_usable_channels, 1); + assert_eq!(channels_info.local_balance_msat, FOURTY_K_SATS); + assert_eq!(channels_info.total_channel_capacities_msat, ONE_M_SATS); - const THOUSAND_SATS: u64 = 1_000_000; - const SECONDS_IN_AN_HOUR: u64 = 3600; - const DESCRIPTION_SAMPLE: &str = "Luke, I Am Your Father"; + let invoice_details = node + .create_invoice(NINE_HUNDRED_K_SATS, "test".to_string(), String::new()) // 800 was okay + .unwrap(); + assert!(invoice_details.invoice.starts_with("lnbc")); + + nigiri::pay_invoice(LspdLnd, &invoice_details.invoice).unwrap(); + assert_eq!( + node.get_node_info().channels_info.local_balance_msat, + NINE_HUNDRED_K_SATS + FOURTY_K_SATS + ); + + nigiri::initiate_channel_from_remote(node.get_node_info().node_pubkey, LspdLnd); + + wait_for_eq!(node.get_node_info().channels_info.num_channels, 2); + wait_for_eq!( + node.get_node_info() + .channels_info + .total_channel_capacities_msat, + ONE_M_SATS * 2 + ); + + let invoice_details = node + .create_invoice(NINE_HUNDRED_K_SATS, "test".to_string(), String::new()) // 800 was okay + .unwrap(); + assert!(invoice_details.invoice.starts_with("lnbc")); + + wait_for!(nigiri::pay_invoice(LspdLnd, &invoice_details.invoice).is_ok()); + assert_eq!( + node.get_node_info().channels_info.local_balance_msat, + NINE_HUNDRED_K_SATS + NINE_HUNDRED_K_SATS + FOURTY_K_SATS + ); + + // Node has 2 channels of 2M SAT each. Paying 1.5M SAT requires sending through both of them + let invoice = nigiri::issue_invoice(LspdLnd, "MPP", MORE_THAN_ONE_M_SATS, 3600).unwrap(); + + node.pay_invoice(invoice, String::new()).unwrap(); + + wait_for!(nigiri::query_node_balance(LspdLnd).unwrap() > MORE_THAN_ONE_M_SATS); + } fn invoice_decode_test(node: &LightningNode) { // Test invoice from CLN From 2def3d55f48187fd0d7bb08efef4cc87c293568a Mon Sep 17 00:00:00 2001 From: Gabriel Comte Date: Tue, 30 May 2023 09:36:50 +0200 Subject: [PATCH 05/11] [no ci] Fix comment MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Daniel Granhão <32176319+danielgranhao@users.noreply.github.com> --- eel/tests/sending_payments_test.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eel/tests/sending_payments_test.rs b/eel/tests/sending_payments_test.rs index cbb2af9c..6062ad29 100644 --- a/eel/tests/sending_payments_test.rs +++ b/eel/tests/sending_payments_test.rs @@ -152,7 +152,7 @@ mod sending_payments_test { NINE_HUNDRED_K_SATS + NINE_HUNDRED_K_SATS + FOURTY_K_SATS ); - // Node has 2 channels of 2M SAT each. Paying 1.5M SAT requires sending through both of them + // Node has 2 channels of 1M SAT each. Paying 1.5M SAT requires sending through both of them let invoice = nigiri::issue_invoice(LspdLnd, "MPP", MORE_THAN_ONE_M_SATS, 3600).unwrap(); node.pay_invoice(invoice, String::new()).unwrap(); From 56ddc34151c3298693c140135c8d14d93e9c8933 Mon Sep 17 00:00:00 2001 From: Gabriel Comte Date: Tue, 30 May 2023 09:43:53 +0200 Subject: [PATCH 06/11] Don't calculate same value twice in int tests MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Daniel Granhão <32176319+danielgranhao@users.noreply.github.com> --- eel/tests/receiving_payments_test.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eel/tests/receiving_payments_test.rs b/eel/tests/receiving_payments_test.rs index fa77f39f..68cb4f13 100644 --- a/eel/tests/receiving_payments_test.rs +++ b/eel/tests/receiving_payments_test.rs @@ -182,7 +182,7 @@ mod receiving_payments_test { assert!(payment_amount > ONE_M_SATS); // Biggest channel is 1M sats; This payment involves transferring through more than 1 channel let invoice = issue_invoice( &node, - node.get_node_info().channels_info.inbound_capacity_msat - TWO_HUNDRED_K_SATS, + payment_amount, ); wait_for!(nigiri::lnd_pay_invoice(NodeInstance::LspdLnd, &invoice).is_ok()); From 601ee4572d41785199c4fe54892c45a02842d6dd Mon Sep 17 00:00:00 2001 From: Gabriel Comte Date: Tue, 30 May 2023 10:33:44 +0200 Subject: [PATCH 07/11] Clarify why there's txs in the mempool MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Daniel Granhão <32176319+danielgranhao@users.noreply.github.com> --- eel/tests/receiving_payments_test.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eel/tests/receiving_payments_test.rs b/eel/tests/receiving_payments_test.rs index 68cb4f13..9474ad53 100644 --- a/eel/tests/receiving_payments_test.rs +++ b/eel/tests/receiving_payments_test.rs @@ -167,7 +167,7 @@ mod receiving_payments_test { // Add 2M sats of inbound capacity - More than the max allowed receive amount let node_id = node.get_node_info().node_pubkey.to_hex(); - assert_eq!(nigiri::get_number_of_txs_in_mempool(), Ok::(2)); // 2 times jit channel open flow + assert_eq!(nigiri::get_number_of_txs_in_mempool(), Ok::(2)); // 2 times jit channel open flow (zero-conf) let _ = nigiri::lnd_node_open_channel(NodeInstance::LspdLnd, &node_id, false).unwrap(); // 1M sats let _ = nigiri::lnd_node_open_channel(NodeInstance::LspdLnd, &node_id, false).unwrap(); // 1M sats wait_for_eq!(nigiri::get_number_of_txs_in_mempool(), Ok::(4)); From e57098c0c6d6a985852e17abf08374ee018c7a95 Mon Sep 17 00:00:00 2001 From: Gabriel Comte Date: Tue, 30 May 2023 10:37:00 +0200 Subject: [PATCH 08/11] Accurately assert balance after payment --- eel/tests/receiving_payments_test.rs | 17 +++++++++-------- eel/tests/sending_payments_test.rs | 6 +++++- 2 files changed, 14 insertions(+), 9 deletions(-) diff --git a/eel/tests/receiving_payments_test.rs b/eel/tests/receiving_payments_test.rs index 9474ad53..33a0c51d 100644 --- a/eel/tests/receiving_payments_test.rs +++ b/eel/tests/receiving_payments_test.rs @@ -177,17 +177,18 @@ mod receiving_payments_test { assert_high_inbound_capacity(&node); // test receiving MPP - let inbound_capacity = node.get_node_info().channels_info.inbound_capacity_msat; - let payment_amount = inbound_capacity - TWO_HUNDRED_K_SATS; // todo use full inbound capacity as soon as the number is accurate - assert!(payment_amount > ONE_M_SATS); // Biggest channel is 1M sats; This payment involves transferring through more than 1 channel - let invoice = issue_invoice( - &node, - payment_amount, - ); + let channels_info = node.get_node_info().channels_info; + let initial_balance = channels_info.local_balance_msat; + let payment_amount = channels_info.inbound_capacity_msat - TWO_HUNDRED_K_SATS; // todo use full inbound capacity as soon as the number is accurate + assert!(payment_amount > ONE_M_SATS); // Biggest channel is 1M sats; This payment involves transferring through more than 1 channel + let invoice = issue_invoice(&node, payment_amount); wait_for!(nigiri::lnd_pay_invoice(NodeInstance::LspdLnd, &invoice).is_ok()); - assert!(node.get_node_info().channels_info.local_balance_msat > TWO_M_SATS); + assert_eq!( + node.get_node_info().channels_info.local_balance_msat, + initial_balance + payment_amount + ); } } diff --git a/eel/tests/sending_payments_test.rs b/eel/tests/sending_payments_test.rs index 6062ad29..fb141a7a 100644 --- a/eel/tests/sending_payments_test.rs +++ b/eel/tests/sending_payments_test.rs @@ -153,11 +153,15 @@ mod sending_payments_test { ); // Node has 2 channels of 1M SAT each. Paying 1.5M SAT requires sending through both of them + let initial_balance = nigiri::query_node_balance(LspdLnd).unwrap(); let invoice = nigiri::issue_invoice(LspdLnd, "MPP", MORE_THAN_ONE_M_SATS, 3600).unwrap(); node.pay_invoice(invoice, String::new()).unwrap(); - wait_for!(nigiri::query_node_balance(LspdLnd).unwrap() > MORE_THAN_ONE_M_SATS); + wait_for_eq!( + nigiri::query_node_balance(LspdLnd).unwrap(), + initial_balance + MORE_THAN_ONE_M_SATS + ); } fn invoice_decode_test(node: &LightningNode) { From e262d27ff2fa9a2ce3f90ba749639f798c4193d4 Mon Sep 17 00:00:00 2001 From: Gabriel Comte Date: Tue, 30 May 2023 10:46:07 +0200 Subject: [PATCH 09/11] Remove unnecessary comment --- eel/tests/sending_payments_test.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/eel/tests/sending_payments_test.rs b/eel/tests/sending_payments_test.rs index fb141a7a..b3adc05a 100644 --- a/eel/tests/sending_payments_test.rs +++ b/eel/tests/sending_payments_test.rs @@ -121,7 +121,7 @@ mod sending_payments_test { assert_eq!(channels_info.total_channel_capacities_msat, ONE_M_SATS); let invoice_details = node - .create_invoice(NINE_HUNDRED_K_SATS, "test".to_string(), String::new()) // 800 was okay + .create_invoice(NINE_HUNDRED_K_SATS, "test".to_string(), String::new()) .unwrap(); assert!(invoice_details.invoice.starts_with("lnbc")); @@ -142,7 +142,7 @@ mod sending_payments_test { ); let invoice_details = node - .create_invoice(NINE_HUNDRED_K_SATS, "test".to_string(), String::new()) // 800 was okay + .create_invoice(NINE_HUNDRED_K_SATS, "test".to_string(), String::new()) .unwrap(); assert!(invoice_details.invoice.starts_with("lnbc")); From 934e6deee968ff37e0a9b097752484070bdf453a Mon Sep 17 00:00:00 2001 From: Gabriel Comte Date: Tue, 30 May 2023 11:38:22 +0200 Subject: [PATCH 10/11] Fix calling of changed fn create_invoice() --- eel/tests/sending_payments_test.rs | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/eel/tests/sending_payments_test.rs b/eel/tests/sending_payments_test.rs index b3adc05a..25011ed2 100644 --- a/eel/tests/sending_payments_test.rs +++ b/eel/tests/sending_payments_test.rs @@ -120,12 +120,13 @@ mod sending_payments_test { assert_eq!(channels_info.local_balance_msat, FOURTY_K_SATS); assert_eq!(channels_info.total_channel_capacities_msat, ONE_M_SATS); - let invoice_details = node + let invoice = node .create_invoice(NINE_HUNDRED_K_SATS, "test".to_string(), String::new()) - .unwrap(); - assert!(invoice_details.invoice.starts_with("lnbc")); + .unwrap() + .to_string(); + assert!(invoice.starts_with("lnbc")); - nigiri::pay_invoice(LspdLnd, &invoice_details.invoice).unwrap(); + nigiri::pay_invoice(LspdLnd, &invoice).unwrap(); assert_eq!( node.get_node_info().channels_info.local_balance_msat, NINE_HUNDRED_K_SATS + FOURTY_K_SATS @@ -141,12 +142,13 @@ mod sending_payments_test { ONE_M_SATS * 2 ); - let invoice_details = node + let invoice = node .create_invoice(NINE_HUNDRED_K_SATS, "test".to_string(), String::new()) - .unwrap(); - assert!(invoice_details.invoice.starts_with("lnbc")); + .unwrap() + .to_string(); + assert!(invoice.starts_with("lnbc")); - wait_for!(nigiri::pay_invoice(LspdLnd, &invoice_details.invoice).is_ok()); + wait_for!(nigiri::pay_invoice(LspdLnd, &invoice).is_ok()); assert_eq!( node.get_node_info().channels_info.local_balance_msat, NINE_HUNDRED_K_SATS + NINE_HUNDRED_K_SATS + FOURTY_K_SATS From 279dd02f91fe0960cbcc9186728beda744ed6803 Mon Sep 17 00:00:00 2001 From: Gabriel Comte Date: Tue, 30 May 2023 11:39:43 +0200 Subject: [PATCH 11/11] Directly get stringified invoice for concise code --- eel/tests/persistence_test.rs | 5 +++-- eel/tests/rapid_gossip_sync_test.rs | 14 ++++++++------ eel/tests/setup/mod.rs | 15 +++++++++------ 3 files changed, 20 insertions(+), 14 deletions(-) diff --git a/eel/tests/persistence_test.rs b/eel/tests/persistence_test.rs index 4654db5b..2a43bdec 100644 --- a/eel/tests/persistence_test.rs +++ b/eel/tests/persistence_test.rs @@ -173,9 +173,10 @@ mod persistence_test { let invoice = node .create_invoice(payment_amount, "test".to_string(), String::new()) - .unwrap(); + .unwrap() + .to_string(); - nigiri::pay_invoice(paying_node, &invoice.to_string()).unwrap(); + nigiri::pay_invoice(paying_node, &invoice).unwrap(); assert_payment_received(node, initial_balance + payment_amount - lsp_fee); } diff --git a/eel/tests/rapid_gossip_sync_test.rs b/eel/tests/rapid_gossip_sync_test.rs index 8204e647..19d4479e 100644 --- a/eel/tests/rapid_gossip_sync_test.rs +++ b/eel/tests/rapid_gossip_sync_test.rs @@ -77,10 +77,11 @@ mod rapid_gossip_sync_test { // Pay from NigiriCln to 3L to create outbound liquidity let invoice_cln = node .create_invoice(HUNDRED_K_SATS, "test".to_string(), String::new()) - .unwrap(); - assert!(invoice_cln.to_string().starts_with("lnbc")); + .unwrap() + .to_string(); + assert!(invoice_cln.starts_with("lnbc")); - nigiri::cln_pay_invoice(NodeInstance::NigiriCln, &invoice_cln.to_string()).unwrap(); + nigiri::cln_pay_invoice(NodeInstance::NigiriCln, &invoice_cln).unwrap(); assert_eq!( node.get_node_info().channels_info.local_balance_msat, @@ -133,10 +134,11 @@ mod rapid_gossip_sync_test { // Pay from NigiriLnd to 3L to create outbound liquidity (LspdLnd -> NigiriLnd) let invoice_lnd = node .create_invoice(HUNDRED_K_SATS, "test".to_string(), String::new()) - .unwrap(); - assert!(invoice_lnd.to_string().starts_with("lnbc")); + .unwrap() + .to_string(); + assert!(invoice_lnd.starts_with("lnbc")); - nigiri::lnd_pay_invoice(NodeInstance::NigiriLnd, &invoice_lnd.to_string()).unwrap(); + nigiri::lnd_pay_invoice(NodeInstance::NigiriLnd, &invoice_lnd).unwrap(); // wait for the RGS server to learn about the new channels (100 seconds isn't enough) sleep(Duration::from_secs(150)); diff --git a/eel/tests/setup/mod.rs b/eel/tests/setup/mod.rs index 734c4664..14311eae 100644 --- a/eel/tests/setup/mod.rs +++ b/eel/tests/setup/mod.rs @@ -102,10 +102,11 @@ pub fn setup_outbound_capacity(node: &LightningNode) { let invoice = node .create_invoice(REBALANCE_AMOUNT, "test".to_string(), String::new()) - .unwrap(); - assert!(invoice.to_string().starts_with("lnbc")); + .unwrap() + .to_string(); + assert!(invoice.starts_with("lnbc")); - nigiri::pay_invoice(LspdLnd, &invoice.to_string()).unwrap(); + nigiri::pay_invoice(LspdLnd, &invoice).unwrap(); assert_eq!( node.get_node_info().channels_info.local_balance_msat, @@ -122,9 +123,11 @@ pub fn setup_outbound_capacity(node: &LightningNode) { pub fn issue_invoice(node: &LightningNode, payment_amount: u64) -> String { let invoice = node .create_invoice(payment_amount, "test".to_string(), String::new()) - .unwrap(); - assert!(invoice.to_string().starts_with("lnbc")); - invoice.to_string() + .unwrap() + .to_string(); + assert!(invoice.starts_with("lnbc")); + + invoice } #[allow(dead_code)]