lightningdevkit / ldk-sample

Sample node implementation using LDK
Apache License 2.0
166 stars 94 forks source link

Use PaymentParameters creation utility and support BOLT12 #129

Closed TheBlueMatt closed 8 months ago

TheBlueMatt commented 8 months ago
$ git diff-tree -U2 b8fc019 afccd1e
diff --git a/src/cli.rs b/src/cli.rs
index 7e79ac9..32a713d 100644
--- a/src/cli.rs
+++ b/src/cli.rs
@@ -184,5 +184,5 @@ pub(crate) fn poll_for_user_input(
                                (_, Some(amt)) => amt,
                                (amt, _) => {
-                                   println!("ERROR: Cannot process non-Bitcoin-amount'd offer value {:?}", amt);
+                                   println!("ERROR: Cannot process non-Bitcoin-denominated offer value {:?}", amt);
                                    continue;
                                }
diff --git a/src/main.rs b/src/main.rs
index 1de7109..6b4dbdd 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -520,6 +520,6 @@ async fn handle_ldk_events(
                        for addr in sockaddrs {
                            let pm = Arc::clone(&peer_manager);
-                           if cli::do_connect_peer(node_id, addr, pm).await.is_ok() {
-                               break;
+                           if cli::connect_peer_if_necessary(node_id, addr, pm).await.is_ok() {
+                               return;
                            }
                        }
tnull commented 8 months ago

CI needs one more cargo fmt here.

TheBlueMatt commented 8 months ago

Ugh, thanks.

$ git diff-tree -U1 afccd1e a9273ad
diff --git a/src/cli.rs b/src/cli.rs
index 32a713d..a70d772 100644
--- a/src/cli.rs
+++ b/src/cli.rs
@@ -180,11 +180,10 @@ pub(crate) fn poll_for_user_input(

-                       let amt_msat =
-                           match (offer.amount(), user_provided_amt) {
-                               (Some(offer::Amount::Bitcoin { amount_msats }), _) => *amount_msats,
-                               (_, Some(amt)) => amt,
-                               (amt, _) => {
-                                   println!("ERROR: Cannot process non-Bitcoin-denominated offer value {:?}", amt);
-                                   continue;
-                               }
-                           };
+                       let amt_msat = match (offer.amount(), user_provided_amt) {
+                           (Some(offer::Amount::Bitcoin { amount_msats }), _) => *amount_msats,
+                           (_, Some(amt)) => amt,
+                           (amt, _) => {
+                               println!("ERROR: Cannot process non-Bitcoin-denominated offer value {:?}", amt);
+                               continue;
+                           }
+                       };
                        if user_provided_amt.is_some() && user_provided_amt != Some(amt_msat) {
$