lightningdevkit / ldk-sample

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

Trivial Usability Fixes #5

Closed TheBlueMatt closed 3 years ago

TheBlueMatt commented 3 years ago

+ panic = abort

TheBlueMatt commented 3 years ago

Squashed. Net diff from first review is:

$ git diff-tree -U0 85ee4a4 HEAD
diff --git a/src/bitcoind_client.rs b/src/bitcoind_client.rs
index f374f6f..6d29ca0 100644
--- a/src/bitcoind_client.rs
+++ b/src/bitcoind_client.rs
@@ -71,2 +71,3 @@ impl BitcoindClient {
-       let _dummy = bitcoind_rpc_client.call_method::<BlockchainInfo>("getblockchaininfo", &vec![])
-           .await.expect("Failed to make initial call to bitcoind - please check your RPC user/password and access settings");
+       let _dummy = bitcoind_rpc_client.call_method::<BlockchainInfo>("getblockchaininfo", &vec![]).await
+           .map_err(|_| std::io::Error::new(std::io::ErrorKind::PermissionDenied,
+               "Failed to make initial call to bitcoind - please check your RPC user/password and access settings"))?;
diff --git a/src/cli.rs b/src/cli.rs
index c5dda5f..32119ae 100644
--- a/src/cli.rs
+++ b/src/cli.rs
@@ -106 +106,3 @@ pub(crate) async fn poll_for_user_input(
-   println!("LDK startup successful. To view available commands: \"help\".\nLDK logs are available at <your-supplied-ldk-data-dir-path>/.ldk/logs");
+   println!("LDK startup successful. To view available commands: \"help\".");
+   println!("LDK logs are available at <your-supplied-ldk-data-dir-path>/.ldk/logs");
+   println!("Local Node ID is {}.", channel_manager.get_our_node_id());
diff --git a/src/main.rs b/src/main.rs
index 8bf4293..7f4b5bf 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -293,2 +293,3 @@ async fn start_ldk() {
-   // Check that the bitcoin we've connected to is running the network we expect
-   if bitcoind_client.get_blockchain_info().await.chain != match args.network {
+   // Check that the bitcoind we've connected to is running the network we expect
+   let bitcoind_chain = bitcoind_client.get_blockchain_info().await.chain;
+   if bitcoind_chain != match args.network {
@@ -300 +301 @@ async fn start_ldk() {
-       println!("Chain argument didn't match bitcoind chain");
+       println!("Chain argument ({}) didn't match bitcoind chain ({})", args.network, bitcoind_chain);
$