From 664285733240b464054667f1d50893407ef1f1b5 Mon Sep 17 00:00:00 2001 From: Asone Date: Wed, 1 Jun 2022 09:44:20 +0200 Subject: [PATCH 1/3] bump dependencies Signed-off-by: Asone --- Cargo.toml | 6 +++--- build.rs | 1 - src/lib.rs | 4 ++-- 3 files changed, 5 insertions(+), 6 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 35d0398..37bcdcd 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -9,8 +9,8 @@ license = "MIT" name = "lnd" [dependencies] -tonic = { version = "0.6", features = ["transport", "codegen", "prost"], default-features = false } -prost = { version = "0.9", default-features = false } +tonic = { version = "0.7.2", features = ["transport", "codegen", "prost"], default-features = false } +prost = { version = "0.10.4", default-features = false } openssl = { version = "0.10", default-features = false } hyper = { version = "0.14", default-features = false } hyper-openssl = { version = "0.9", default-features = false } @@ -18,4 +18,4 @@ hex = { version = "0.4", features = ["std"], default-features = false } thiserror = { version = "1.0", default-features = false } [build-dependencies] -tonic-build = "0.6" +tonic-build = "0.7.2" diff --git a/build.rs b/build.rs index 1e106f3..3d90748 100644 --- a/build.rs +++ b/build.rs @@ -13,6 +13,5 @@ fn main() -> Result<(), std::io::Error> { tonic_build::configure() .build_server(false) .out_dir(BUILD_DIR) - .format(false) .compile(&PROTOS, &[PROTOS_NS]) } diff --git a/src/lib.rs b/src/lib.rs index c49e615..f6290a7 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -79,7 +79,7 @@ impl Lnd { Lnd::connector(certificate_bytes).map_err(LndConnectError::Connector)?; let transport = tonic::transport::Endpoint::new(destination) - .and_then(move |d| d.connect_with_connector_lazy(https_connector)) + .and_then(move |d| Ok(d.connect_with_connector_lazy(https_connector))) .map_err(LndConnectError::Transport)?; Ok(Lnd::build(transport, LndInterceptor::noop())) @@ -142,7 +142,7 @@ struct LndInterceptor { impl LndInterceptor { fn macaroon(bytes: &[u8]) -> Result { - let macaroon = Some(MetadataValue::from_str(&hex::encode(bytes))?); + let macaroon = Some(MetadataValue::try_from(&hex::encode(bytes))?); Ok(Self { macaroon }) } From 7dfcfdc2dbb4a956e5d9a6ab67c90180f5cdd21c Mon Sep 17 00:00:00 2001 From: Asone Date: Wed, 1 Jun 2022 19:39:45 +0200 Subject: [PATCH 2/3] update: use map instead of and_then when creating lazy connection Signed-off-by: Asone --- src/lib.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lib.rs b/src/lib.rs index f6290a7..bf1af74 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -79,7 +79,7 @@ impl Lnd { Lnd::connector(certificate_bytes).map_err(LndConnectError::Connector)?; let transport = tonic::transport::Endpoint::new(destination) - .and_then(move |d| Ok(d.connect_with_connector_lazy(https_connector))) + .map(move |d| d.connect_with_connector_lazy(https_connector)) .map_err(LndConnectError::Transport)?; Ok(Lnd::build(transport, LndInterceptor::noop())) From c6336393b29a0f4c8be1a1232113838a17131701 Mon Sep 17 00:00:00 2001 From: Asone Date: Thu, 2 Jun 2022 22:29:53 +0200 Subject: [PATCH 3/3] update: gitignore to ignore target results and sensitive files in examples subfolders --- .gitignore | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.gitignore b/.gitignore index 20201c9..8e19748 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,6 @@ /target Cargo.lock src/gen +examples/*/*.cert +examples/*/*.macaroon +examples/*/target/