From bc88608e8d686d2bf20e517376c15bc929803dc4 Mon Sep 17 00:00:00 2001 From: Orbital Date: Thu, 11 Jan 2024 21:06:25 -0600 Subject: [PATCH 1/7] itests: set more granular lnd logs --- tests/common/mod.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/common/mod.rs b/tests/common/mod.rs index af7e505e..8d11bc47 100644 --- a/tests/common/mod.rs +++ b/tests/common/mod.rs @@ -206,6 +206,7 @@ impl LndNode { format!("--tlscertpath={}", cert_path), format!("--tlskeypath={}", key_path), format!("--logdir={}", log_dir.display()), + format!("--debuglevel=info,PEER=info"), format!("--bitcoind.rpcuser={}", connect_params.0.unwrap()), format!("--bitcoind.rpcpass={}", connect_params.1.unwrap()), format!( From b9fdec5f9ef389c3cdfcbc9eeda085d2e4680559 Mon Sep 17 00:00:00 2001 From: Orbital Date: Thu, 11 Jan 2024 21:07:47 -0600 Subject: [PATCH 2/7] itests: add lnd new_address api call --- tests/common/mod.rs | 27 ++++++++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) diff --git a/tests/common/mod.rs b/tests/common/mod.rs index 8d11bc47..9b370d73 100644 --- a/tests/common/mod.rs +++ b/tests/common/mod.rs @@ -15,7 +15,7 @@ use std::thread; use std::{env, fs}; use tempfile::{tempdir, Builder, TempDir}; use tokio::time::{sleep, timeout, Duration}; -use tonic_lnd::lnrpc::GetInfoRequest; +use tonic_lnd::lnrpc::{AddressType, GetInfoRequest}; use tonic_lnd::Client; const LNDK_TESTS_FOLDER: &str = "lndk-tests"; @@ -397,4 +397,29 @@ impl LndNode { sleep(Duration::from_secs(2)).await; } } + + // Create an on-chain bitcoin address to fund our LND node. + #[allow(dead_code)] + pub async fn new_address(&mut self) -> tonic_lnd::lnrpc::NewAddressResponse { + let addr_req = tonic_lnd::lnrpc::NewAddressRequest { + r#type: AddressType::TaprootPubkey.into(), + ..Default::default() + }; + + let resp = if let Some(client) = self.client.clone() { + let make_request = || async { + client + .clone() + .lightning() + .new_address(addr_req.clone()) + .await + }; + let resp = test_utils::retry_async(make_request, String::from("new_address")); + resp.await.unwrap() + } else { + panic!("No client") + }; + + resp + } } From 2bca1c5cf58f473b4b438ffc73f7a8af53bb8015 Mon Sep 17 00:00:00 2001 From: Orbital Date: Tue, 23 Jan 2024 15:37:15 -0600 Subject: [PATCH 3/7] actions: install protobuf-compiler so we can build tonic_lnd --- .github/workflows/main.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index d346bc80..86b0f79b 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -18,6 +18,7 @@ jobs: - uses: actions-rs/toolchain@v1 with: toolchain: stable + - run: sudo apt-get install protobuf-compiler - uses: actions-rs/cargo@v1 name: cargo build with: @@ -47,6 +48,7 @@ jobs: - uses: actions-rs/toolchain@v1 with: toolchain: stable + - run: sudo apt-get install protobuf-compiler - name: setup go ${{ env.GO_VERSION }} uses: lightningnetwork/lnd/.github/actions/setup-go@v0-16-4-branch with: @@ -66,6 +68,7 @@ jobs: - uses: actions-rs/toolchain@v1 with: toolchain: stable + - run: sudo apt-get install protobuf-compiler - name: Install cargo-llvm-cov uses: taiki-e/install-action@cargo-llvm-cov - name: Generate code coverage From 39e92e8baf14e4b80c719ac0ffc1ae19fbb8e2e3 Mon Sep 17 00:00:00 2001 From: Orbital Date: Thu, 18 Jan 2024 14:48:25 -0600 Subject: [PATCH 4/7] Bump tonic_lnd to a custom version We use a custom version of tonic_lnd that has the blinded route support in the QueryRoute and SendToRoute commands, which won't officially be released in lnd until v18. --- Cargo.toml | 2 +- src/lib.rs | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/Cargo.toml b/Cargo.toml index beb2e402..a6780b81 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -25,7 +25,7 @@ log = "0.4.17" log4rs = { version = "1.2.0", features = ["file_appender"] } tokio = { version = "1.25.0", features = ["rt", "rt-multi-thread"] } tonic = "0.8.3" -tonic_lnd = { git = "https://github.com/orbitalturtle/tonic_lnd", branch = "update-signer-client" } +tonic_lnd = { git = "https://github.com/orbitalturtle/tonic_lnd", branch="update-signer-and-lightning", package="fedimint-tonic-lnd", features = ["lightningrpc", "routerrpc"] } hex = "0.4.3" configure_me = "0.4.0" bytes = "1.4.0" diff --git a/src/lib.rs b/src/lib.rs index e7e253fb..9da72638 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -110,6 +110,7 @@ impl LndkOnionMessenger { .into_inner(); let mut network_str = None; + #[allow(deprecated)] for chain in info.chains { if chain.chain == "bitcoin" { network_str = Some(chain.network.clone()) From 16847c03ab33f5593574db58de71dd0143b4db58 Mon Sep 17 00:00:00 2001 From: Orbital Date: Mon, 22 Jan 2024 16:15:23 -0600 Subject: [PATCH 5/7] multi: Upgrade to ldk v20 We update to ldk v20 for the latest blinded route updates, namely being able to create a blinded route that's more than one hop. On top of that we use a custom versoin with a small change, which we need in order to send an onion message along a specified path for LNDK's integration tests: lightningdevkit/rust-lightning#2868 --- Cargo.lock | 883 +++++++++++++++++++------------------ Cargo.toml | 6 +- src/lib.rs | 14 +- src/lndk_offers.rs | 5 +- src/onion_messenger.rs | 21 +- tests/integration_tests.rs | 2 +- 6 files changed, 481 insertions(+), 450 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 1ed7b67f..141df76c 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -43,9 +43,9 @@ dependencies = [ [[package]] name = "anstream" -version = "0.6.4" +version = "0.6.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2ab91ebe16eb252986481c5b62f6098f3b698a45e34b5b98200cf20dd2484a44" +checksum = "6e2e1ebcb11de5c03c67de28a7df593d32191b44939c482e97702baaaa6ab6a5" dependencies = [ "anstyle", "anstyle-parse", @@ -57,43 +57,43 @@ dependencies = [ [[package]] name = "anstyle" -version = "1.0.4" +version = "1.0.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7079075b41f533b8c61d2a4d073c4676e1f8b249ff94a393b0595db304e0dd87" +checksum = "8901269c6307e8d93993578286ac0edf7f195079ffff5ebdeea6a59ffb7e36bc" [[package]] name = "anstyle-parse" -version = "0.2.2" +version = "0.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "317b9a89c1868f5ea6ff1d9539a69f45dffc21ce321ac1fd1160dfa48c8e2140" +checksum = "c75ac65da39e5fe5ab759307499ddad880d724eed2f6ce5b5e8a26f4f387928c" dependencies = [ "utf8parse", ] [[package]] name = "anstyle-query" -version = "1.0.0" +version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5ca11d4be1bab0c8bc8734a9aa7bf4ee8316d462a08c6ac5052f888fef5b494b" +checksum = "e28923312444cdd728e4738b3f9c9cac739500909bb3d3c94b43551b16517648" dependencies = [ - "windows-sys", + "windows-sys 0.52.0", ] [[package]] name = "anstyle-wincon" -version = "3.0.1" +version = "3.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f0699d10d2f4d628a98ee7b57b289abbc98ff3bad977cb3152709d4bf2330628" +checksum = "1cd54b81ec8d6180e24654d0b371ad22fc3dd083b6ff8ba325b72e00c87660a7" dependencies = [ "anstyle", - "windows-sys", + "windows-sys 0.52.0", ] [[package]] name = "anyhow" -version = "1.0.75" +version = "1.0.79" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a4668cab20f66d8d020e1fbc0ebe47217433c1b6c8f2040faf858554e394ace6" +checksum = "080e9890a082662b09c1ad45f567faeeb47f22b5fb23895fbe1e651e718e25ca" [[package]] name = "arc-swap" @@ -120,18 +120,18 @@ checksum = "16e62a023e7c117e27523144c5d2459f4397fcc3cab0085af8e2224f643a0193" dependencies = [ "proc-macro2", "quote", - "syn 2.0.39", + "syn 2.0.48", ] [[package]] name = "async-trait" -version = "0.1.74" +version = "0.1.77" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a66537f1bb974b254c98ed142ff995236e81b9d0fe4db0575f46612cb15eb0f9" +checksum = "c980ee35e870bd1a4d2c8294d4c04d0499e67bca1e4b5cefcc693c2fa00caea9" dependencies = [ "proc-macro2", "quote", - "syn 2.0.39", + "syn 2.0.48", ] [[package]] @@ -208,9 +208,9 @@ checksum = "9e1b586273c5702936fe7b7d6896644d8be71e6314cfe09d3167c95f712589e8" [[package]] name = "base64" -version = "0.21.5" +version = "0.21.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "35636a1494ede3b646cc98f74f8e62c773a38a659ebc777a2cf26b9b74171df9" +checksum = "9d297deb1925b89f2ccc13d7635fa0714f12c87adce1c75356b39ca9b7178567" [[package]] name = "bech32" @@ -237,13 +237,14 @@ dependencies = [ [[package]] name = "bitcoin" -version = "0.30.1" +version = "0.30.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4e99ff7289b20a7385f66a0feda78af2fc119d28fb56aea8886a9cd0a4abdd75" +checksum = "1945a5048598e4189e239d3f809b19bdad4845c4b2ba400d304d2dcf26d2c462" dependencies = [ "bech32 0.9.1", "bitcoin-private", "bitcoin_hashes 0.12.0", + "bitcoinconsensus", "hex_lit", "secp256k1 0.27.0", "serde", @@ -280,6 +281,16 @@ dependencies = [ "serde", ] +[[package]] +name = "bitcoinconsensus" +version = "0.20.2-0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "54505558b77e0aa21b2491a7b39cbae9db22ac8b1bc543ef4600edb762306f9c" +dependencies = [ + "cc", + "libc", +] + [[package]] name = "bitcoind" version = "0.30.0" @@ -306,9 +317,9 @@ checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" [[package]] name = "bitflags" -version = "2.4.1" +version = "2.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "327762f6e5a765692301e5bb513e0d9fef63be86bbc14528052b1cd3e6f03e07" +checksum = "ed570934406eb16438a4e976b1b4500774099c13b8cb96eec99f620f05090ddf" [[package]] name = "bumpalo" @@ -361,9 +372,9 @@ dependencies = [ [[package]] name = "cc" -version = "1.0.84" +version = "1.0.83" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0f8e7c90afad890484a21653d08b6e209ae34770fb5ee298f9c699fcc1e5c856" +checksum = "f1174fb0b6ec23863f8b971027804a42614e347eafb0a95bf0b12cdae21fc4d0" dependencies = [ "libc", ] @@ -376,29 +387,29 @@ checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" [[package]] name = "chrono" -version = "0.4.31" +version = "0.4.33" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7f2c685bad3eb3d45a01354cedb7d5faa66194d1d58ba6e267a8de788f79db38" +checksum = "9f13690e35a5e4ace198e7beea2895d29f3a9cc55015fcebe6336bd2010af9eb" dependencies = [ "android-tzdata", "iana-time-zone", "js-sys", "num-traits", "wasm-bindgen", - "windows-targets", + "windows-targets 0.52.0", ] [[package]] name = "chunked_transfer" -version = "1.4.1" +version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cca491388666e04d7248af3f60f0c40cfb0991c72205595d7c396e3510207d1a" +checksum = "6e4de3bc4ea267985becf712dc6d9eed8b04c953b3fcfb339ebc87acd9804901" [[package]] name = "clap" -version = "4.4.8" +version = "4.4.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2275f18819641850fa26c89acc84d465c1bf91ce57bc2748b28c420473352f64" +checksum = "1e578d6ec4194633722ccf9544794b71b1385c3c027efe0c55db226fc880865c" dependencies = [ "clap_builder", "clap_derive", @@ -406,9 +417,9 @@ dependencies = [ [[package]] name = "clap_builder" -version = "4.4.8" +version = "4.4.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "07cdf1b148b25c1e1f7a42225e30a0d99a615cd4637eae7365548dd4529b95bc" +checksum = "4df4df40ec50c46000231c914968278b1eb05098cf8f1b3a518a95030e71d1c7" dependencies = [ "anstream", "anstyle", @@ -422,10 +433,10 @@ version = "4.4.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cf9804afaaf59a91e75b022a30fb7229a7901f60c755489cc61c9b423b836442" dependencies = [ - "heck 0.4.1", + "heck", "proc-macro2", "quote", - "syn 2.0.39", + "syn 2.0.48", ] [[package]] @@ -470,9 +481,9 @@ dependencies = [ [[package]] name = "core-foundation-sys" -version = "0.8.4" +version = "0.8.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e496a50fda8aacccc86d7529e2c1e0892dbd0f898a6b5645b5561b89c3210efa" +checksum = "06ea2b9bc92be3c2baa9334a323ebca2d6f074ff852cd1d7b11064035cd3868f" [[package]] name = "core-rpc" @@ -494,7 +505,7 @@ version = "0.17.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "581898ed9a83f31c64731b1d8ca2dfffcfec14edf1635afacd5234cddbde3a41" dependencies = [ - "bitcoin 0.30.1", + "bitcoin 0.30.2", "bitcoin-private", "serde", "serde_json", @@ -544,14 +555,20 @@ version = "1.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a26ae43d7bcc3b814de94796a5e736d4029efb0ee900c12e2d54c993ad1a1e07" +[[package]] +name = "equivalent" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5" + [[package]] name = "errno" -version = "0.3.6" +version = "0.3.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7c18ee0ed65a5f1f81cac6b1d213b69c35fa47d4252ad41f1486dbd8226fe36e" +checksum = "a258e46cdc063eb8519c00b9fc845fc47bcfca4130e2f08e88665ceda8474245" dependencies = [ "libc", - "windows-sys", + "windows-sys 0.52.0", ] [[package]] @@ -560,23 +577,42 @@ version = "2.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "25cbce373ec4653f1a01a31e8a5e5ec0c622dc27ff9c4e6606eefef5cbbed4a5" +[[package]] +name = "fedimint-tonic-lnd" +version = "0.1.3" +source = "git+https://github.com/orbitalturtle/tonic_lnd?branch=update-signer-and-lightning#60ad239b092336db02110dc85397004731b451c6" +dependencies = [ + "hex", + "http-body", + "hyper", + "hyper-rustls", + "prost 0.12.3", + "rustls", + "rustls-pemfile", + "tokio", + "tokio-stream", + "tonic 0.10.2", + "tonic-build", + "tower", +] + [[package]] name = "filetime" -version = "0.2.22" +version = "0.2.23" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d4029edd3e734da6fe05b6cd7bd2960760a616bd2ddd0d59a0124746d6272af0" +checksum = "1ee447700ac8aa0b2f2bd7bc4462ad686ba06baa6727ac149a2d6277f0d240fd" dependencies = [ "cfg-if", "libc", - "redox_syscall 0.3.5", - "windows-sys", + "redox_syscall", + "windows-sys 0.52.0", ] [[package]] name = "fixedbitset" -version = "0.2.0" +version = "0.4.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "37ab347416e802de484e4d03c7316c48f1ecb56574dfd4a46a80f173ce1de04d" +checksum = "0ce7134b9999ecaf8bcd65542e436736ef32ddca1b3e06094cb6ec5755203b80" [[package]] name = "flate2" @@ -623,9 +659,9 @@ checksum = "a06f77d526c1a601b7c4cdd98f54b5eaabffc14d5f2f0296febdc7f357c6d3ba" [[package]] name = "futures" -version = "0.3.29" +version = "0.3.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "da0290714b38af9b4a7b094b8a37086d1b4e61f2df9122c3cad2577669145335" +checksum = "645c6916888f6cb6350d2550b80fb63e734897a8498abe35cfb732b6487804b0" dependencies = [ "futures-channel", "futures-core", @@ -638,9 +674,9 @@ dependencies = [ [[package]] name = "futures-channel" -version = "0.3.29" +version = "0.3.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ff4dd66668b557604244583e3e1e1eada8c5c2e96a6d0d6653ede395b78bbacb" +checksum = "eac8f7d7865dcb88bd4373ab671c8cf4508703796caa2b1985a9ca867b3fcb78" dependencies = [ "futures-core", "futures-sink", @@ -648,15 +684,15 @@ dependencies = [ [[package]] name = "futures-core" -version = "0.3.29" +version = "0.3.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eb1d22c66e66d9d72e1758f0bd7d4fd0bee04cad842ee34587d68c07e45d088c" +checksum = "dfc6580bb841c5a68e9ef15c77ccc837b40a7504914d52e47b8b0e9bbda25a1d" [[package]] name = "futures-executor" -version = "0.3.29" +version = "0.3.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0f4fb8693db0cf099eadcca0efe2a5a22e4550f98ed16aba6c48700da29597bc" +checksum = "a576fc72ae164fca6b9db127eaa9a9dda0d61316034f33a0a0d4eda41f02b01d" dependencies = [ "futures-core", "futures-task", @@ -665,38 +701,38 @@ dependencies = [ [[package]] name = "futures-io" -version = "0.3.29" +version = "0.3.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8bf34a163b5c4c52d0478a4d757da8fb65cabef42ba90515efee0f6f9fa45aaa" +checksum = "a44623e20b9681a318efdd71c299b6b222ed6f231972bfe2f224ebad6311f0c1" [[package]] name = "futures-macro" -version = "0.3.29" +version = "0.3.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "53b153fd91e4b0147f4aced87be237c98248656bb01050b96bf3ee89220a8ddb" +checksum = "87750cf4b7a4c0625b1529e4c543c2182106e4dedc60a2a6455e00d212c489ac" dependencies = [ "proc-macro2", "quote", - "syn 2.0.39", + "syn 2.0.48", ] [[package]] name = "futures-sink" -version = "0.3.29" +version = "0.3.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e36d3378ee38c2a36ad710c5d30c2911d752cb941c00c72dbabfb786a7970817" +checksum = "9fb8e00e87438d937621c1c6269e53f536c14d3fbd6a042bb24879e57d474fb5" [[package]] name = "futures-task" -version = "0.3.29" +version = "0.3.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "efd193069b0ddadc69c46389b740bbccdd97203899b48d09c5f7969591d6bae2" +checksum = "38d84fa142264698cdce1a9f9172cf383a0c82de1bddcf3092901442c4097004" [[package]] name = "futures-util" -version = "0.3.29" +version = "0.3.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a19526d624e703a3179b3d322efec918b6246ea0fa51d41124525f00f1cc8104" +checksum = "3d6401deb83407ab3da39eba7e33987a73c3df0c82b4bb5813ee871c19c41d48" dependencies = [ "futures-channel", "futures-core", @@ -712,9 +748,9 @@ dependencies = [ [[package]] name = "getrandom" -version = "0.2.11" +version = "0.2.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fe9006bed769170c11f845cf00c7c1e9092aeb3f268e007c3e760ac68008070f" +checksum = "190092ea657667030ac6a35e305e62fc4dd69fd98ac98631e5d3a2b1575a12b5" dependencies = [ "cfg-if", "libc", @@ -723,15 +759,15 @@ dependencies = [ [[package]] name = "gimli" -version = "0.28.0" +version = "0.28.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6fb8d784f27acf97159b40fc4db5ecd8aa23b9ad5ef69cdd136d3bc80665f0c0" +checksum = "4271d37baee1b8c7e4b708028c57d816cf9d2434acb33a549475f78c181f6253" [[package]] name = "h2" -version = "0.3.21" +version = "0.3.24" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "91fc23aa11be92976ef4729127f1a74adf36d8436f7816b185d18df956790833" +checksum = "bb2c4422095b67ee78da96fbb51a4cc413b3b25883c7717ff7ca1ab31022c9c9" dependencies = [ "bytes", "fnv", @@ -739,10 +775,10 @@ dependencies = [ "futures-sink", "futures-util", "http", - "indexmap", + "indexmap 2.2.2", "slab", "tokio", - "tokio-util 0.7.10", + "tokio-util", "tracing", ] @@ -753,13 +789,10 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888" [[package]] -name = "heck" -version = "0.3.3" +name = "hashbrown" +version = "0.14.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6d621efb26863f0e9924c6ac577e8275e5e6b77455db64ffa6c65c904e9e132c" -dependencies = [ - "unicode-segmentation", -] +checksum = "290f1a1d9242c78d09ce40a5e87e7554ee637af1351968159f4952f028f75604" [[package]] name = "heck" @@ -769,9 +802,9 @@ checksum = "95505c38b4572b2d910cecb0281560f54b440a19336cbbcb27bf6ce6adc6f5a8" [[package]] name = "hermit-abi" -version = "0.3.3" +version = "0.3.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d77f7ec81a6d05a3abb01ab6eb7590f6083d08449fe5a1c8b1e620283546ccb7" +checksum = "d0c62115964e08cb8039170eb33c1d0e2388a256930279edca206fff675f82c3" [[package]] name = "hex" @@ -779,6 +812,12 @@ version = "0.4.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70" +[[package]] +name = "hex-conservative" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "30ed443af458ccb6d81c1e7e661545f94d3176752fb1df2f543b902a1e0f51e2" + [[package]] name = "hex_lit" version = "0.1.1" @@ -787,11 +826,11 @@ checksum = "3011d1213f159867b13cfd6ac92d2cd5f1345762c63be3554e84092d85a50bbd" [[package]] name = "home" -version = "0.5.5" +version = "0.5.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5444c27eef6923071f7ebcc33e3444508466a76f7a2b93da00ed6e19f30c1ddb" +checksum = "e3d1354bf6b7235cb4a0576c2619fd4ed18183f689b12b006a0ee7329eeff9a5" dependencies = [ - "windows-sys", + "windows-sys 0.52.0", ] [[package]] @@ -807,9 +846,9 @@ dependencies = [ [[package]] name = "http-body" -version = "0.4.5" +version = "0.4.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d5f38f16d184e36f2408a55281cd658ecbd3ca05cce6d6510a176eca393e26d1" +checksum = "7ceab25649e9960c0311ea418d17bee82c0dcec1bd053b5f9a66e265a693bed2" dependencies = [ "bytes", "http", @@ -836,9 +875,9 @@ checksum = "9a3a5bfb195931eeb336b2a7b4d761daec841b97f947d34394601737a7bba5e4" [[package]] name = "hyper" -version = "0.14.27" +version = "0.14.28" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ffb1cfd654a8219eaef89881fdb3bb3b1cdc5fa75ded05d6933b2b382e395468" +checksum = "bf96e135eb83a2a8ddf766e426a841d8ddd7449d5f00d34ea02b41d2f19eef80" dependencies = [ "bytes", "futures-channel", @@ -851,13 +890,27 @@ dependencies = [ "httpdate", "itoa", "pin-project-lite", - "socket2 0.4.10", + "socket2", "tokio", "tower-service", "tracing", "want", ] +[[package]] +name = "hyper-rustls" +version = "0.24.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ec3efd23720e2049821a693cbc7e65ea87c72f1c58ff2f9522ff332b1491e590" +dependencies = [ + "futures-util", + "http", + "hyper", + "rustls", + "tokio", + "tokio-rustls", +] + [[package]] name = "hyper-timeout" version = "0.4.1" @@ -872,9 +925,9 @@ dependencies = [ [[package]] name = "iana-time-zone" -version = "0.1.58" +version = "0.1.60" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8326b86b6cff230b97d0d312a6c40a60726df3332e721f72a1b035f451663b20" +checksum = "e7ffbb5a1b541ea2561f8c41c087286cc091e21e556a4f09a8f6cbf17b69b141" dependencies = [ "android_system_properties", "core-foundation-sys", @@ -900,7 +953,17 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "bd070e393353796e801d209ad339e89596eb4c8d430d18ede6a1cced8fafbd99" dependencies = [ "autocfg", - "hashbrown", + "hashbrown 0.12.3", +] + +[[package]] +name = "indexmap" +version = "2.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "824b2ae422412366ba479e8111fd301f7b5faece8149317bb81925979a53f520" +dependencies = [ + "equivalent", + "hashbrown 0.14.3", ] [[package]] @@ -912,17 +975,26 @@ dependencies = [ "either", ] +[[package]] +name = "itertools" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b1c173a5686ce8bfa551b3563d0c2170bf24ca44da99c7ca4bfdab5418c3fe57" +dependencies = [ + "either", +] + [[package]] name = "itoa" -version = "1.0.9" +version = "1.0.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "af150ab688ff2122fcef229be89cb50dd66af9e01a4ff320cc137eecc9bacc38" +checksum = "b1a46d1a171d865aa5f83f92695765caa047a9b4cbae2cbf37dbd613a793fd4c" [[package]] name = "js-sys" -version = "0.3.65" +version = "0.3.68" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "54c0c35952f67de54bb584e9fd912b3023117cbafc0a77d8f3dee1fb5f572fe8" +checksum = "406cda4b368d531c842222cf9d2600a9a4acce8d29423695379c6868a143a9ee" dependencies = [ "wasm-bindgen", ] @@ -947,15 +1019,15 @@ checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" [[package]] name = "ldk-sample" version = "0.1.0" -source = "git+https://github.com/lndk-org/ldk-sample?branch=change-node-announcement-interval#d24839740b44048568341ca37e289557eff52fd9" +source = "git+https://github.com/lndk-org/ldk-sample?branch=offer-handling-send-payment#fdc9b2905dff4b9f293f91a6fd13e9f084812567" dependencies = [ "base64 0.13.1", "bech32 0.8.1", - "bitcoin 0.29.2", + "bitcoin 0.30.2", "bitcoin-bech32", "chrono", "libc", - "lightning 0.0.118", + "lightning 0.0.120", "lightning-background-processor", "lightning-block-sync", "lightning-invoice", @@ -971,9 +1043,9 @@ dependencies = [ [[package]] name = "libc" -version = "0.2.150" +version = "0.2.153" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "89d92a4743f9a61002fae18374ed11e7973f530cb3a3255fb354818118b2203c" +checksum = "9c198f91728a82281a64e1f4f9eeb25d82cb32a5de251c6bd1b5154d63a8e7bd" [[package]] name = "lightning" @@ -986,31 +1058,34 @@ dependencies = [ [[package]] name = "lightning" -version = "0.0.118" -source = "git+https://github.com/orbitalturtle/rust-lightning?branch=v0.0.118-custom#07cb4d3ec5a9b7d9b338721061f69e80ca3d5381" +version = "0.0.120" +source = "git+https://github.com/lightningdevkit/rust-lightning?rev=06f9dd7#06f9dd7e83ae8ba5b5ecac3cffa404e16d06d4e4" dependencies = [ - "bitcoin 0.29.2", + "bitcoin 0.30.2", + "hex-conservative", "musig2", + "regex", ] [[package]] name = "lightning-background-processor" -version = "0.0.118" -source = "git+https://github.com/orbitalturtle/rust-lightning?branch=v0.0.118-custom#07cb4d3ec5a9b7d9b338721061f69e80ca3d5381" +version = "0.0.120" +source = "git+https://github.com/lightningdevkit/rust-lightning?rev=06f9dd7#06f9dd7e83ae8ba5b5ecac3cffa404e16d06d4e4" dependencies = [ - "bitcoin 0.29.2", - "lightning 0.0.118", + "bitcoin 0.30.2", + "lightning 0.0.120", "lightning-rapid-gossip-sync", ] [[package]] name = "lightning-block-sync" -version = "0.0.118" -source = "git+https://github.com/orbitalturtle/rust-lightning?branch=v0.0.118-custom#07cb4d3ec5a9b7d9b338721061f69e80ca3d5381" +version = "0.0.120" +source = "git+https://github.com/lightningdevkit/rust-lightning?rev=06f9dd7#06f9dd7e83ae8ba5b5ecac3cffa404e16d06d4e4" dependencies = [ - "bitcoin 0.29.2", + "bitcoin 0.30.2", "chunked_transfer", - "lightning 0.0.118", + "hex-conservative", + "lightning 0.0.120", "serde_json", "tokio", ] @@ -1031,31 +1106,31 @@ dependencies = [ [[package]] name = "lightning-net-tokio" -version = "0.0.118" -source = "git+https://github.com/orbitalturtle/rust-lightning?branch=v0.0.118-custom#07cb4d3ec5a9b7d9b338721061f69e80ca3d5381" +version = "0.0.120" +source = "git+https://github.com/lightningdevkit/rust-lightning?rev=06f9dd7#06f9dd7e83ae8ba5b5ecac3cffa404e16d06d4e4" dependencies = [ - "bitcoin 0.29.2", - "lightning 0.0.118", + "bitcoin 0.30.2", + "lightning 0.0.120", "tokio", ] [[package]] name = "lightning-persister" -version = "0.0.118" -source = "git+https://github.com/orbitalturtle/rust-lightning?branch=v0.0.118-custom#07cb4d3ec5a9b7d9b338721061f69e80ca3d5381" +version = "0.0.120" +source = "git+https://github.com/lightningdevkit/rust-lightning?rev=06f9dd7#06f9dd7e83ae8ba5b5ecac3cffa404e16d06d4e4" dependencies = [ - "bitcoin 0.29.2", - "lightning 0.0.118", - "windows-sys", + "bitcoin 0.30.2", + "lightning 0.0.120", + "windows-sys 0.48.0", ] [[package]] name = "lightning-rapid-gossip-sync" -version = "0.0.118" -source = "git+https://github.com/orbitalturtle/rust-lightning?branch=v0.0.118-custom#07cb4d3ec5a9b7d9b338721061f69e80ca3d5381" +version = "0.0.120" +source = "git+https://github.com/lightningdevkit/rust-lightning?rev=06f9dd7#06f9dd7e83ae8ba5b5ecac3cffa404e16d06d4e4" dependencies = [ - "bitcoin 0.29.2", - "lightning 0.0.118", + "bitcoin 0.30.2", + "lightning 0.0.120", ] [[package]] @@ -1066,16 +1141,16 @@ checksum = "0717cef1bc8b636c6e1c1bbdefc09e6322da8a9321966e8928ef80d20f7f770f" [[package]] name = "linux-raw-sys" -version = "0.4.11" +version = "0.4.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "969488b55f8ac402214f3f5fd243ebb7206cf82de60d3172994707a4bcc2b829" +checksum = "01cda141df6706de531b6c46c3a33ecca755538219bd484262fa09410c13539c" [[package]] name = "lndk" version = "0.0.1" dependencies = [ "async-trait", - "bitcoin 0.29.2", + "bitcoin 0.30.2", "bitcoind", "bytes", "chrono", @@ -1083,11 +1158,12 @@ dependencies = [ "configure_me", "configure_me_codegen", "core-rpc", + "fedimint-tonic-lnd", "futures", "hex", "home", "ldk-sample", - "lightning 0.0.118", + "lightning 0.0.120", "log", "log4rs", "mockall", @@ -1096,7 +1172,6 @@ dependencies = [ "tempfile", "tokio", "tonic 0.8.3", - "tonic_lnd", "triggered", ] @@ -1168,9 +1243,9 @@ checksum = "0e7465ac9959cc2b1404e8e2367b43684a6d13790fe23056cc8c6c5a6b7bcb94" [[package]] name = "memchr" -version = "2.6.4" +version = "2.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f665ee40bc4a3c5590afb1e9677db74a508659dfd71e126420da8274909a0167" +checksum = "523dc4f511e55ab87b694dc30d0f820d60906ef06413f93d4d7a1385599cc149" [[package]] name = "mime" @@ -1180,9 +1255,9 @@ checksum = "6877bb514081ee2a7ff5ef9de3281f14a4dd4bceac4c09388074a6b5df8a139a" [[package]] name = "miniz_oxide" -version = "0.7.1" +version = "0.7.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e7810e0be55b428ada41041c41f32c9f1a42817901b4ccf45fa3d4b6561e74c7" +checksum = "9d811f3e15f28568be3407c8e7fdb6514c1cda3cb30683f15b6a1a1dc4ea14a7" dependencies = [ "adler", ] @@ -1195,20 +1270,20 @@ checksum = "cb3371dfc7b772c540da1380123674a8e20583aca99907087d990ca58cf44203" dependencies = [ "log", "once_cell", - "rustls 0.21.8", + "rustls", "rustls-webpki", "webpki-roots", ] [[package]] name = "mio" -version = "0.8.9" +version = "0.8.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3dce281c5e46beae905d4de1870d8b1509a9142b62eedf18b443b011ca8343d0" +checksum = "8f3d0b296e374a4e6f3c7b0a1f5a51d748a0d34c85e7dc48fc3fa9a87657fe09" dependencies = [ "libc", "wasi 0.11.0+wasi-snapshot-preview1", - "windows-sys", + "windows-sys 0.48.0", ] [[package]] @@ -1247,9 +1322,9 @@ checksum = "e5ce46fe64a9d73be07dcbe690a38ce1b293be448fd8ce1e6c1b8062c9f72c6a" [[package]] name = "musig2" version = "0.1.0" -source = "git+https://github.com/arik-so/rust-musig2?rev=27797d7#27797d78cf64e8974e38d7f31ebb11e455015a9e" +source = "git+https://github.com/arik-so/rust-musig2?rev=cff11e3#cff11e3b1af1691f721a120dc6acb921afa31f89" dependencies = [ - "bitcoin 0.29.2", + "bitcoin 0.30.2", ] [[package]] @@ -1260,9 +1335,9 @@ checksum = "61807f77802ff30975e01f4f071c8ba10c022052f98b3294119f3e615d13e5be" [[package]] name = "num-traits" -version = "0.2.17" +version = "0.2.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "39e3200413f237f41ab11ad6d161bc7239c84dcb631773ccd7de3dfe4b5c267c" +checksum = "da0df0e5185db44f69b44f26786fe401b6c293d1907744beaa7fa62b2e5a517a" dependencies = [ "autocfg", ] @@ -1279,18 +1354,18 @@ dependencies = [ [[package]] name = "object" -version = "0.32.1" +version = "0.32.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9cf5f9dd3933bd50a9e1f149ec995f39ae2c496d31fd772c1fd45ebc27e902b0" +checksum = "a6a622008b6e321afc04970976f62ee297fdbaa6f95318ca343e3eebb9648441" dependencies = [ "memchr", ] [[package]] name = "once_cell" -version = "1.18.0" +version = "1.19.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dd8b5dd2ae5ed71462c540258bedcb51965123ad7e7ccf4b9a8cafaa4a63576d" +checksum = "3fdb12b2476b595f9358c5161aa467c2438859caa136dec86c26fdd2efe17b92" [[package]] name = "ordered-float" @@ -1319,9 +1394,9 @@ checksum = "4c42a9226546d68acdd9c0a280d17ce19bfe27a46bf68784e4066115788d008e" dependencies = [ "cfg-if", "libc", - "redox_syscall 0.4.1", + "redox_syscall", "smallvec", - "windows-targets", + "windows-targets 0.48.5", ] [[package]] @@ -1332,38 +1407,38 @@ checksum = "14248cc8eced350e20122a291613de29e4fa129ba2731818c4cdbb44fccd3e55" [[package]] name = "percent-encoding" -version = "2.3.0" +version = "2.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9b2a4787296e9989611394c33f193f676704af1686e70b8f8033ab5ba9a35a94" +checksum = "e3148f5046208a5d56bcfc03053e3ca6334e51da8dfb19b6cdc8b306fae3283e" [[package]] name = "petgraph" -version = "0.5.1" +version = "0.6.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "467d164a6de56270bd7c4d070df81d07beace25012d5103ced4e9ff08d6afdb7" +checksum = "e1d3afd2628e69da2be385eb6f2fd57c8ac7977ceeff6dc166ff1657b0e386a9" dependencies = [ "fixedbitset", - "indexmap", + "indexmap 2.2.2", ] [[package]] name = "pin-project" -version = "1.1.3" +version = "1.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fda4ed1c6c173e3fc7a83629421152e01d7b1f9b7f65fb301e490e8cfc656422" +checksum = "0302c4a0442c456bd56f841aee5c3bfd17967563f6fadc9ceb9f9c23cf3807e0" dependencies = [ "pin-project-internal", ] [[package]] name = "pin-project-internal" -version = "1.1.3" +version = "1.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4359fd9c9171ec6e8c62926d6faaf553a8dc3f64e1507e76da7911b4f6a04405" +checksum = "266c042b60c9c76b8d53061e52b2e0d1116abc57cefc8c5cd671619a56ac3690" dependencies = [ "proc-macro2", "quote", - "syn 2.0.39", + "syn 2.0.48", ] [[package]] @@ -1380,9 +1455,9 @@ checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" [[package]] name = "pkg-config" -version = "0.3.27" +version = "0.3.29" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "26072860ba924cbfa98ea39c8c19b4dd6a4a25423dbdf219c1eca91aa0cf6964" +checksum = "2900ede94e305130c13ddd391e0ab7cbaeb783945ae07a279c268cb05109c6cb" [[package]] name = "ppv-lite86" @@ -1398,7 +1473,7 @@ checksum = "59230a63c37f3e18569bdb90e4a89cbf5bf8b06fea0b84e65ea10cc4df47addd" dependencies = [ "difflib", "float-cmp", - "itertools", + "itertools 0.10.5", "normalize-line-endings", "predicates-core", "regex", @@ -1421,83 +1496,74 @@ dependencies = [ ] [[package]] -name = "proc-macro2" -version = "1.0.69" +name = "prettyplease" +version = "0.2.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "134c189feb4956b20f6f547d2cf727d4c0fe06722b20a0eec87ed445a97f92da" +checksum = "a41cf62165e97c7f814d2221421dbb9afcbcdb0a88068e5ea206e19951c2cbb5" dependencies = [ - "unicode-ident", + "proc-macro2", + "syn 2.0.48", ] [[package]] -name = "prost" -version = "0.8.0" +name = "proc-macro2" +version = "1.0.78" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "de5e2533f59d08fcf364fd374ebda0692a70bd6d7e66ef97f306f45c6c5d8020" +checksum = "e2422ad645d89c99f8f3e6b88a9fdeca7fabeac836b1002371c4367c8f984aae" dependencies = [ - "bytes", - "prost-derive 0.8.0", + "unicode-ident", ] [[package]] name = "prost" -version = "0.9.0" +version = "0.11.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "444879275cb4fd84958b1a1d5420d15e6fcf7c235fe47f053c9c2a80aceb6001" +checksum = "0b82eaa1d779e9a4bc1c3217db8ffbeabaae1dca241bf70183242128d48681cd" dependencies = [ "bytes", - "prost-derive 0.9.0", + "prost-derive 0.11.9", ] [[package]] name = "prost" -version = "0.11.9" +version = "0.12.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0b82eaa1d779e9a4bc1c3217db8ffbeabaae1dca241bf70183242128d48681cd" +checksum = "146c289cda302b98a28d40c8b3b90498d6e526dd24ac2ecea73e4e491685b94a" dependencies = [ "bytes", - "prost-derive 0.11.9", + "prost-derive 0.12.3", ] [[package]] name = "prost-build" -version = "0.8.0" +version = "0.12.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "355f634b43cdd80724ee7848f95770e7e70eefa6dcf14fea676216573b8fd603" +checksum = "c55e02e35260070b6f716a2423c2ff1c3bb1642ddca6f99e1f26d06268a0e2d2" dependencies = [ "bytes", - "heck 0.3.3", - "itertools", + "heck", + "itertools 0.11.0", "log", "multimap", + "once_cell", "petgraph", - "prost 0.8.0", + "prettyplease", + "prost 0.12.3", "prost-types", + "regex", + "syn 2.0.48", "tempfile", "which", ] [[package]] name = "prost-derive" -version = "0.8.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "600d2f334aa05acb02a755e217ef1ab6dea4d51b58b7846588b747edec04efba" -dependencies = [ - "anyhow", - "itertools", - "proc-macro2", - "quote", - "syn 1.0.109", -] - -[[package]] -name = "prost-derive" -version = "0.9.0" +version = "0.11.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f9cc1a3263e07e0bf68e96268f37665207b49560d98739662cdfaae215c720fe" +checksum = "e5d2d8d10f3c6ded6da8b05b5fb3b8a5082514344d56c9f871412d29b4e075b4" dependencies = [ "anyhow", - "itertools", + "itertools 0.10.5", "proc-macro2", "quote", "syn 1.0.109", @@ -1505,32 +1571,31 @@ dependencies = [ [[package]] name = "prost-derive" -version = "0.11.9" +version = "0.12.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e5d2d8d10f3c6ded6da8b05b5fb3b8a5082514344d56c9f871412d29b4e075b4" +checksum = "efb6c9a1dd1def8e2124d17e83a20af56f1570d6c2d2bd9e266ccb768df3840e" dependencies = [ "anyhow", - "itertools", + "itertools 0.11.0", "proc-macro2", "quote", - "syn 1.0.109", + "syn 2.0.48", ] [[package]] name = "prost-types" -version = "0.8.0" +version = "0.12.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "603bbd6394701d13f3f25aada59c7de9d35a6a5887cfc156181234a44002771b" +checksum = "193898f59edcf43c26227dcd4c8427f00d99d61e95dcde58dabd49fa291d470e" dependencies = [ - "bytes", - "prost 0.8.0", + "prost 0.12.3", ] [[package]] name = "quote" -version = "1.0.33" +version = "1.0.35" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5267fca4496028628a95160fc423a33e8b2e6af8a5302579e322e4b520293cae" +checksum = "291ec9ab5efd934aaf503a6466c5d5251535d108ee747472c3977cc5acc868ef" dependencies = [ "proc-macro2", ] @@ -1602,15 +1667,6 @@ dependencies = [ "rand_core 0.3.1", ] -[[package]] -name = "redox_syscall" -version = "0.3.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "567664f262709473930a4bf9e51bf2ebf3348f2e748ccc50dea20646858f8f29" -dependencies = [ - "bitflags 1.3.2", -] - [[package]] name = "redox_syscall" version = "0.4.1" @@ -1622,9 +1678,9 @@ dependencies = [ [[package]] name = "regex" -version = "1.10.2" +version = "1.10.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "380b951a9c5e80ddfd6136919eef32310721aa4aacd4889a8d39124b026ab343" +checksum = "b62dbe01f0b06f9d8dc7d49e05a0785f153b00b2c227856282f671e0318c9b15" dependencies = [ "aho-corasick", "memchr", @@ -1634,9 +1690,9 @@ dependencies = [ [[package]] name = "regex-automata" -version = "0.4.3" +version = "0.4.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5f804c7828047e88b2d32e2d7fe5a105da8ee3264f01902f796c8e067dc2483f" +checksum = "5bb987efffd3c6d0d8f5f89510bb458559eab11e4f869acb20bf845e016259cd" dependencies = [ "aho-corasick", "memchr", @@ -1651,31 +1707,16 @@ checksum = "c08c74e62047bb2de4ff487b251e4a92e24f48745648451635cec7d591162d9f" [[package]] name = "ring" -version = "0.16.20" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3053cf52e236a3ed746dfc745aa9cacf1b791d846bdaf412f60a8d7d6e17c8fc" -dependencies = [ - "cc", - "libc", - "once_cell", - "spin 0.5.2", - "untrusted 0.7.1", - "web-sys", - "winapi", -] - -[[package]] -name = "ring" -version = "0.17.5" +version = "0.17.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fb0205304757e5d899b9c2e448b867ffd03ae7f988002e47cd24954391394d0b" +checksum = "688c63d65483050968b2a8937f7995f443e27041a0f7700aa59b0822aedebb74" dependencies = [ "cc", "getrandom", "libc", - "spin 0.9.8", - "untrusted 0.9.0", - "windows-sys", + "spin", + "untrusted", + "windows-sys 0.48.0", ] [[package]] @@ -1692,40 +1733,27 @@ checksum = "d626bb9dae77e28219937af045c257c28bfd3f69333c512553507f5f9798cb76" [[package]] name = "rustix" -version = "0.38.21" +version = "0.38.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2b426b0506e5d50a7d8dafcf2e81471400deb602392c7dd110815afb4eaf02a3" +checksum = "6ea3e1a662af26cd7a3ba09c0297a31af215563ecf42817c98df621387f4e949" dependencies = [ - "bitflags 2.4.1", + "bitflags 2.4.2", "errno", "libc", "linux-raw-sys", - "windows-sys", + "windows-sys 0.52.0", ] [[package]] name = "rustls" -version = "0.19.1" +version = "0.21.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "35edb675feee39aec9c99fa5ff985081995a06d594114ae14cbe797ad7b7a6d7" +checksum = "f9d5a6813c0759e4609cd494e8e725babae6a2ca7b62a5536a13daaec6fcb7ba" dependencies = [ - "base64 0.13.1", "log", - "ring 0.16.20", - "sct 0.6.1", - "webpki", -] - -[[package]] -name = "rustls" -version = "0.21.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "446e14c5cda4f3f30fe71863c34ec70f5ac79d6087097ad0bb433e1be5edf04c" -dependencies = [ - "log", - "ring 0.17.5", + "ring", "rustls-webpki", - "sct 0.7.1", + "sct", ] [[package]] @@ -1734,7 +1762,7 @@ version = "1.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1c74cae0a4cf6ccbbf5f359f08efdf8ee7e1dc532573bf0db71968cb56b1448c" dependencies = [ - "base64 0.21.5", + "base64 0.21.7", ] [[package]] @@ -1743,8 +1771,8 @@ version = "0.101.7" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8b6275d1ee7a1cd780b64aca7726599a1dbc893b1e64144529e55c3c2f745765" dependencies = [ - "ring 0.17.5", - "untrusted 0.9.0", + "ring", + "untrusted", ] [[package]] @@ -1755,9 +1783,9 @@ checksum = "7ffc183a10b4478d04cbbbfc96d0873219d962dd5accaff2ffbd4ceb7df837f4" [[package]] name = "ryu" -version = "1.0.15" +version = "1.0.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1ad4cc8da4ef723ed60bced201181d83791ad433213d8c24efffda1eec85d741" +checksum = "f98d2aa92eebf49b69786be48e4477826b256916e84a57ff2a4f21923b48eb4c" [[package]] name = "scopeguard" @@ -1765,24 +1793,14 @@ version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" -[[package]] -name = "sct" -version = "0.6.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b362b83898e0e69f38515b82ee15aa80636befe47c3b6d3d89a911e78fc228ce" -dependencies = [ - "ring 0.16.20", - "untrusted 0.7.1", -] - [[package]] name = "sct" version = "0.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "da046153aa2352493d6cb7da4b6e5c0c057d8a1d0a9aa8560baffdd945acd414" dependencies = [ - "ring 0.17.5", - "untrusted 0.9.0", + "ring", + "untrusted", ] [[package]] @@ -1792,7 +1810,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6b1629c9c557ef9b293568b338dddfc8208c98a18c59d722a9d53f859d9c9b62" dependencies = [ "bitcoin_hashes 0.11.0", - "rand 0.8.5", "secp256k1-sys 0.6.1", ] @@ -1828,9 +1845,9 @@ dependencies = [ [[package]] name = "serde" -version = "1.0.192" +version = "1.0.196" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bca2a08484b285dcb282d0f67b26cadc0df8b19f8c12502c13d966bf9482f001" +checksum = "870026e60fa08c69f064aa766c10f10b1d62db9ccd4d0abb206472bee0ce3b32" dependencies = [ "serde_derive", ] @@ -1847,20 +1864,20 @@ dependencies = [ [[package]] name = "serde_derive" -version = "1.0.192" +version = "1.0.196" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d6c7207fbec9faa48073f3e3074cbe553af6ea512d7c21ba46e434e70ea9fbc1" +checksum = "33c85360c95e7d137454dc81d9a4ed2b8efd8fbe19cee57357b32b9771fccb67" dependencies = [ "proc-macro2", "quote", - "syn 2.0.39", + "syn 2.0.48", ] [[package]] name = "serde_json" -version = "1.0.108" +version = "1.0.113" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3d1c7e3eac408d115102c4c24ad393e0821bb3a5df4d506a80f85f7a742a526b" +checksum = "69801b70b1c3dac963ecb03a364ba0ceda9cf60c71cfe475e99864759c8b8a79" dependencies = [ "itoa", "ryu", @@ -1873,7 +1890,7 @@ version = "0.8.26" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "578a7433b776b56a35785ed5ce9a7e777ac0598aac5a6dd1b4b18a307c7fc71b" dependencies = [ - "indexmap", + "indexmap 1.9.3", "ryu", "serde", "yaml-rust", @@ -1890,19 +1907,9 @@ dependencies = [ [[package]] name = "smallvec" -version = "1.11.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4dccd0940a2dcdf68d092b8cbab7dc0ad8fa938bf95787e1b916b0e3d0e8e970" - -[[package]] -name = "socket2" -version = "0.4.10" +version = "1.13.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9f7916fc008ca5542385b89a3d3ce689953c143e9304a9bf8beec1de48994c0d" -dependencies = [ - "libc", - "winapi", -] +checksum = "e6ecd384b10a64542d77071bd64bd7b231f4ed5940fba55e98c3de13824cf3d7" [[package]] name = "socket2" @@ -1911,15 +1918,9 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7b5fac59a5cb5dd637972e5fca70daf0523c9067fcdc4842f053dae04a18f8e9" dependencies = [ "libc", - "windows-sys", + "windows-sys 0.48.0", ] -[[package]] -name = "spin" -version = "0.5.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6e63cff320ae2c57904679ba7cb63280a3dc4613885beafb148ee7bf9aa9042d" - [[package]] name = "spin" version = "0.9.8" @@ -1945,9 +1946,9 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.39" +version = "2.0.48" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "23e78b90f2fcf45d3e842032ce32e3f2d1545ba6636271dcbf24fa306d87be7a" +checksum = "0f3531638e407dfc0814761abb7c00a5b54992b849452a0646b7f65c9f770f3f" dependencies = [ "proc-macro2", "quote", @@ -1973,15 +1974,14 @@ dependencies = [ [[package]] name = "tempfile" -version = "3.8.1" +version = "3.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7ef1adac450ad7f4b3c28589471ade84f25f731a7a0fe30d71dfa9f60fd808e5" +checksum = "a365e8cd18e44762ef95d87f284f4b5cd04107fec2ff3052bd6a3e6069669e67" dependencies = [ "cfg-if", "fastrand", - "redox_syscall 0.4.1", "rustix", - "windows-sys", + "windows-sys 0.52.0", ] [[package]] @@ -1992,22 +1992,22 @@ checksum = "3369f5ac52d5eb6ab48c6b4ffdc8efbcad6b89c765749064ba298f2c68a16a76" [[package]] name = "thiserror" -version = "1.0.50" +version = "1.0.56" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f9a7210f5c9a7156bb50aa36aed4c95afb51df0df00713949448cf9e97d382d2" +checksum = "d54378c645627613241d077a3a79db965db602882668f9136ac42af9ecb730ad" dependencies = [ "thiserror-impl", ] [[package]] name = "thiserror-impl" -version = "1.0.50" +version = "1.0.56" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "266b2e40bc00e5a6c09c3584011e08b06f123c00362c92b975ba9843aaaa14b8" +checksum = "fa0faa943b50f3db30a20aa7e265dbc66076993efed8463e8de414e5d06d3471" dependencies = [ "proc-macro2", "quote", - "syn 2.0.39", + "syn 2.0.48", ] [[package]] @@ -2033,9 +2033,9 @@ dependencies = [ [[package]] name = "tokio" -version = "1.34.0" +version = "1.36.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d0c014766411e834f7af5b8f4cf46257aab4036ca95e9d2c144a10f59ad6f5b9" +checksum = "61285f6515fa018fb2d1e46eb21223fff441ee8db5d0f1435e8ab4f5cdb80931" dependencies = [ "backtrace", "bytes", @@ -2043,9 +2043,9 @@ dependencies = [ "mio", "num_cpus", "pin-project-lite", - "socket2 0.5.5", + "socket2", "tokio-macros", - "windows-sys", + "windows-sys 0.48.0", ] [[package]] @@ -2066,18 +2066,17 @@ checksum = "5b8a1e28f2deaa14e508979454cb3a223b10b938b45af148bc0986de36f1923b" dependencies = [ "proc-macro2", "quote", - "syn 2.0.39", + "syn 2.0.48", ] [[package]] name = "tokio-rustls" -version = "0.22.0" +version = "0.24.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bc6844de72e57df1980054b38be3a9f4702aba4858be64dd700181a8a6d0e1b6" +checksum = "c28327cf380ac148141087fbfb9de9d7bd4e84ab5d2c28fbc911d753de8a7081" dependencies = [ - "rustls 0.19.1", + "rustls", "tokio", - "webpki", ] [[package]] @@ -2091,20 +2090,6 @@ dependencies = [ "tokio", ] -[[package]] -name = "tokio-util" -version = "0.6.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "36943ee01a6d67977dd3f84a5a1d2efeb4ada3a1ae771cadfaa535d9d9fc6507" -dependencies = [ - "bytes", - "futures-core", - "futures-sink", - "log", - "pin-project-lite", - "tokio", -] - [[package]] name = "tokio-util" version = "0.7.10" @@ -2130,12 +2115,13 @@ dependencies = [ [[package]] name = "tonic" -version = "0.6.2" +version = "0.8.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ff08f4649d10a70ffa3522ca559031285d8e421d727ac85c60825761818f5d0a" +checksum = "8f219fad3b929bef19b1f86fbc0358d35daed8f2cac972037ac0dc10bbb8d5fb" dependencies = [ "async-stream", "async-trait", + "axum", "base64 0.13.1", "bytes", "futures-core", @@ -2147,12 +2133,11 @@ dependencies = [ "hyper-timeout", "percent-encoding", "pin-project", - "prost 0.9.0", - "prost-derive 0.9.0", + "prost 0.11.9", + "prost-derive 0.11.9", "tokio", - "tokio-rustls", "tokio-stream", - "tokio-util 0.6.10", + "tokio-util", "tower", "tower-layer", "tower-service", @@ -2162,17 +2147,15 @@ dependencies = [ [[package]] name = "tonic" -version = "0.8.3" +version = "0.10.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8f219fad3b929bef19b1f86fbc0358d35daed8f2cac972037ac0dc10bbb8d5fb" +checksum = "d560933a0de61cf715926b9cac824d4c883c2c43142f787595e48280c40a1d0e" dependencies = [ "async-stream", "async-trait", "axum", - "base64 0.13.1", + "base64 0.21.7", "bytes", - "futures-core", - "futures-util", "h2", "http", "http-body", @@ -2180,43 +2163,29 @@ dependencies = [ "hyper-timeout", "percent-encoding", "pin-project", - "prost 0.11.9", - "prost-derive 0.11.9", + "prost 0.12.3", + "rustls", + "rustls-pemfile", "tokio", + "tokio-rustls", "tokio-stream", - "tokio-util 0.7.10", "tower", "tower-layer", "tower-service", "tracing", - "tracing-futures", ] [[package]] name = "tonic-build" -version = "0.5.2" +version = "0.10.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "12b52d07035516c2b74337d2ac7746075e7dcae7643816c1b12c5ff8a7484c08" +checksum = "9d021fc044c18582b9a2408cd0dd05b1596e3ecdb5c4df822bb0183545683889" dependencies = [ + "prettyplease", "proc-macro2", "prost-build", "quote", - "syn 1.0.109", -] - -[[package]] -name = "tonic_lnd" -version = "0.5.1" -source = "git+https://github.com/orbitalturtle/tonic_lnd?branch=update-signer-client#de989089fdb23f87d3e6bc4796c504bda9b9be9b" -dependencies = [ - "hex", - "prost 0.9.0", - "rustls 0.19.1", - "rustls-pemfile", - "tokio", - "tonic 0.6.2", - "tonic-build", - "webpki", + "syn 2.0.48", ] [[package]] @@ -2227,13 +2196,13 @@ checksum = "b8fa9be0de6cf49e536ce1851f987bd21a43b771b09473c3549a6c853db37c1c" dependencies = [ "futures-core", "futures-util", - "indexmap", + "indexmap 1.9.3", "pin-project", "pin-project-lite", "rand 0.8.5", "slab", "tokio", - "tokio-util 0.7.10", + "tokio-util", "tower-layer", "tower-service", "tracing", @@ -2271,7 +2240,7 @@ checksum = "34704c8d6ebcbc939824180af020566b01a7c01f80641264eba0999f6c2b6be7" dependencies = [ "proc-macro2", "quote", - "syn 2.0.39", + "syn 2.0.48", ] [[package]] @@ -2301,9 +2270,9 @@ checksum = "ce148eae0d1a376c1b94ae651fc3261d9cb8294788b962b7382066376503a2d1" [[package]] name = "try-lock" -version = "0.2.4" +version = "0.2.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3528ecfd12c466c6f163363caf2d02a71161dd5e1cc6ae7b34207ea2d42d81ed" +checksum = "e421abadd41a4225275504ea4d6566923418b7f05506fbc9c0fe86ba7396114b" [[package]] name = "typemap-ors" @@ -2322,9 +2291,9 @@ checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b" [[package]] name = "unicode-segmentation" -version = "1.10.1" +version = "1.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1dd624098567895118886609431a7c3b8f516e41d30e0643f03d94592a147e36" +checksum = "d4c87d22b6e3f4a18d4d40ef354e97c90fcb14dd91d7dc0aa9d8a1172ebf7202" [[package]] name = "unsafe-any-ors" @@ -2335,12 +2304,6 @@ dependencies = [ "destructure_traitobject", ] -[[package]] -name = "untrusted" -version = "0.7.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a156c684c91ea7d62626509bce3cb4e1d9ed5c4d978f7b4352658f96a4c26b4a" - [[package]] name = "untrusted" version = "0.9.0" @@ -2382,9 +2345,9 @@ checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" [[package]] name = "wasm-bindgen" -version = "0.2.88" +version = "0.2.91" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7daec296f25a1bae309c0cd5c29c4b260e510e6d813c286b19eaadf409d40fce" +checksum = "c1e124130aee3fb58c5bdd6b639a0509486b0338acaaae0c84a5124b0f588b7f" dependencies = [ "cfg-if", "wasm-bindgen-macro", @@ -2392,24 +2355,24 @@ dependencies = [ [[package]] name = "wasm-bindgen-backend" -version = "0.2.88" +version = "0.2.91" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e397f4664c0e4e428e8313a469aaa58310d302159845980fd23b0f22a847f217" +checksum = "c9e7e1900c352b609c8488ad12639a311045f40a35491fb69ba8c12f758af70b" dependencies = [ "bumpalo", "log", "once_cell", "proc-macro2", "quote", - "syn 2.0.39", + "syn 2.0.48", "wasm-bindgen-shared", ] [[package]] name = "wasm-bindgen-macro" -version = "0.2.88" +version = "0.2.91" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5961017b3b08ad5f3fe39f1e79877f8ee7c23c5e5fd5eb80de95abc41f1f16b2" +checksum = "b30af9e2d358182b5c7449424f017eba305ed32a7010509ede96cdc4696c46ed" dependencies = [ "quote", "wasm-bindgen-macro-support", @@ -2417,48 +2380,28 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro-support" -version = "0.2.88" +version = "0.2.91" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c5353b8dab669f5e10f5bd76df26a9360c748f054f862ff5f3f8aae0c7fb3907" +checksum = "642f325be6301eb8107a83d12a8ac6c1e1c54345a7ef1a9261962dfefda09e66" dependencies = [ "proc-macro2", "quote", - "syn 2.0.39", + "syn 2.0.48", "wasm-bindgen-backend", "wasm-bindgen-shared", ] [[package]] name = "wasm-bindgen-shared" -version = "0.2.88" +version = "0.2.91" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0d046c5d029ba91a1ed14da14dca44b68bf2f124cfbaf741c54151fdb3e0750b" - -[[package]] -name = "web-sys" -version = "0.3.65" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5db499c5f66323272151db0e666cd34f78617522fb0c1604d31a27c50c206a85" -dependencies = [ - "js-sys", - "wasm-bindgen", -] - -[[package]] -name = "webpki" -version = "0.21.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b8e38c0608262c46d4a56202ebabdeb094cef7e560ca7a226c6bf055188aa4ea" -dependencies = [ - "ring 0.16.20", - "untrusted 0.7.1", -] +checksum = "4f186bd2dcf04330886ce82d6f33dd75a7bfcf69ecf5763b89fcde53b6ac9838" [[package]] name = "webpki-roots" -version = "0.25.2" +version = "0.25.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "14247bb57be4f377dfb94c72830b8ce8fc6beac03cf4bf7b9732eadd414123fc" +checksum = "5f20c57d8d7db6d3b86154206ae5d8fba62dd39573114de97c2cb0578251f8e1" [[package]] name = "which" @@ -2496,11 +2439,11 @@ checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" [[package]] name = "windows-core" -version = "0.51.1" +version = "0.52.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f1f8cf84f35d2db49a46868f947758c7a1138116f7fac3bc844f43ade1292e64" +checksum = "33ab640c8d7e35bf8ba19b884ba838ceb4fba93a4e8c65a9059d08afcfc683d9" dependencies = [ - "windows-targets", + "windows-targets 0.52.0", ] [[package]] @@ -2509,7 +2452,16 @@ version = "0.48.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "677d2418bec65e3338edb076e806bc1ec15693c5d0104683f2efe857f61056a9" dependencies = [ - "windows-targets", + "windows-targets 0.48.5", +] + +[[package]] +name = "windows-sys" +version = "0.52.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d" +dependencies = [ + "windows-targets 0.52.0", ] [[package]] @@ -2518,13 +2470,28 @@ version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9a2fa6e2155d7247be68c096456083145c183cbbbc2764150dda45a87197940c" dependencies = [ - "windows_aarch64_gnullvm", - "windows_aarch64_msvc", - "windows_i686_gnu", - "windows_i686_msvc", - "windows_x86_64_gnu", - "windows_x86_64_gnullvm", - "windows_x86_64_msvc", + "windows_aarch64_gnullvm 0.48.5", + "windows_aarch64_msvc 0.48.5", + "windows_i686_gnu 0.48.5", + "windows_i686_msvc 0.48.5", + "windows_x86_64_gnu 0.48.5", + "windows_x86_64_gnullvm 0.48.5", + "windows_x86_64_msvc 0.48.5", +] + +[[package]] +name = "windows-targets" +version = "0.52.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8a18201040b24831fbb9e4eb208f8892e1f50a37feb53cc7ff887feb8f50e7cd" +dependencies = [ + "windows_aarch64_gnullvm 0.52.0", + "windows_aarch64_msvc 0.52.0", + "windows_i686_gnu 0.52.0", + "windows_i686_msvc 0.52.0", + "windows_x86_64_gnu 0.52.0", + "windows_x86_64_gnullvm 0.52.0", + "windows_x86_64_msvc 0.52.0", ] [[package]] @@ -2533,49 +2500,93 @@ version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2b38e32f0abccf9987a4e3079dfb67dcd799fb61361e53e2882c3cbaf0d905d8" +[[package]] +name = "windows_aarch64_gnullvm" +version = "0.52.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cb7764e35d4db8a7921e09562a0304bf2f93e0a51bfccee0bd0bb0b666b015ea" + [[package]] name = "windows_aarch64_msvc" version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "dc35310971f3b2dbbf3f0690a219f40e2d9afcf64f9ab7cc1be722937c26b4bc" +[[package]] +name = "windows_aarch64_msvc" +version = "0.52.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bbaa0368d4f1d2aaefc55b6fcfee13f41544ddf36801e793edbbfd7d7df075ef" + [[package]] name = "windows_i686_gnu" version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a75915e7def60c94dcef72200b9a8e58e5091744960da64ec734a6c6e9b3743e" +[[package]] +name = "windows_i686_gnu" +version = "0.52.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a28637cb1fa3560a16915793afb20081aba2c92ee8af57b4d5f28e4b3e7df313" + [[package]] name = "windows_i686_msvc" version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8f55c233f70c4b27f66c523580f78f1004e8b5a8b659e05a4eb49d4166cca406" +[[package]] +name = "windows_i686_msvc" +version = "0.52.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ffe5e8e31046ce6230cc7215707b816e339ff4d4d67c65dffa206fd0f7aa7b9a" + [[package]] name = "windows_x86_64_gnu" version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "53d40abd2583d23e4718fddf1ebec84dbff8381c07cae67ff7768bbf19c6718e" +[[package]] +name = "windows_x86_64_gnu" +version = "0.52.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3d6fa32db2bc4a2f5abeacf2b69f7992cd09dca97498da74a151a3132c26befd" + [[package]] name = "windows_x86_64_gnullvm" version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0b7b52767868a23d5bab768e390dc5f5c55825b6d30b86c844ff2dc7414044cc" +[[package]] +name = "windows_x86_64_gnullvm" +version = "0.52.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1a657e1e9d3f514745a572a6846d3c7aa7dbe1658c056ed9c3344c4109a6949e" + [[package]] name = "windows_x86_64_msvc" version = "0.48.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ed94fce61571a4006852b7389a063ab983c02eb1bb37b47f8272ce92d06d9538" +[[package]] +name = "windows_x86_64_msvc" +version = "0.52.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dff9641d1cd4be8d1a070daf9e3773c5f67e78b4d9d42263020c057706765c04" + [[package]] name = "xattr" -version = "1.0.1" +version = "1.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f4686009f71ff3e5c4dbcf1a282d0a44db3f021ba69350cd42086b3e5f1c6985" +checksum = "8da84f1a25939b27f6820d92aed108f83ff920fdf11a7b19366c27c4cda81d4f" dependencies = [ "libc", + "linux-raw-sys", + "rustix", ] [[package]] diff --git a/Cargo.toml b/Cargo.toml index a6780b81..9b4aa33d 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -14,11 +14,11 @@ spec = "config_spec.toml" [dependencies] async-trait = "0.1.66" -bitcoin = { version = "0.29.2", features = ["rand"] } +bitcoin = { version = "0.30.2", features = ["rand"] } clap = { version = "4.4.6", features = ["derive"] } futures = "0.3.26" home = "0.5.5" -lightning = { git = "https://github.com/orbitalturtle/rust-lightning", branch = "v0.0.118-custom", features = ["max_level_trace"] } +lightning = { git = "https://github.com/lightningdevkit/rust-lightning", rev = "06f9dd7", features = ["max_level_trace", "_test_utils"] } rand_chacha = "0.3.1" rand_core = "0.6.4" log = "0.4.17" @@ -35,7 +35,7 @@ triggered = "0.1.2" bitcoincore-rpc = { package="core-rpc", version = "0.17.0" } bitcoind = { version = "0.30.0", features = [ "22_0" ] } chrono = { version = "0.4.26" } -ldk-sample = { git = "https://github.com/lndk-org/ldk-sample", branch = "change-node-announcement-interval" } +ldk-sample = { git = "https://github.com/lndk-org/ldk-sample", branch = "offer-handling-send-payment" } mockall = "0.11.3" tempfile = "3.5.0" diff --git a/src/lib.rs b/src/lib.rs index 9da72638..263150c8 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -18,10 +18,11 @@ use lightning::ln::inbound_payment::ExpandedKey; use lightning::ln::peer_handler::IgnoringMessageHandler; use lightning::offers::invoice_error::InvoiceError; use lightning::offers::offer::Offer; -use lightning::onion_message::{ - DefaultMessageRouter, Destination, OffersMessage, OffersMessageHandler, OnionMessenger, - PendingOnionMessage, +use lightning::onion_message::messenger::{ + DefaultMessageRouter, Destination, OnionMessenger, PendingOnionMessage, }; +use lightning::onion_message::offers::{OffersMessage, OffersMessageHandler}; +use lightning::routing::gossip::NetworkGraph; use lightning::sign::{EntropySource, KeyMaterial}; use log::{error, info, LevelFilter}; use log4rs::append::console::ConsoleAppender; @@ -121,6 +122,7 @@ impl LndkOnionMessenger { return Err(()); } let network = string_to_network(&network_str.unwrap()); + let network = network.unwrap(); let pubkey = PublicKey::from_str(&info.identity_pubkey).unwrap(); info!("Starting lndk for node: {pubkey}."); @@ -153,11 +155,13 @@ impl LndkOnionMessenger { let mut node_client = client.signer().clone(); let node_signer = LndNodeSigner::new(pubkey, &mut node_client); let messenger_utils = MessengerUtilities::new(); + let network_graph = &NetworkGraph::new(network, &messenger_utils); + let message_router = &DefaultMessageRouter::new(network_graph); let onion_messenger = OnionMessenger::new( &messenger_utils, &node_signer, &messenger_utils, - &DefaultMessageRouter {}, + message_router, &self.offer_handler, IgnoringMessageHandler {}, ); @@ -167,7 +171,7 @@ impl LndkOnionMessenger { peer_support, &mut peers_client, onion_messenger, - network.unwrap(), + network, args.signals, ) .await diff --git a/src/lndk_offers.rs b/src/lndk_offers.rs index bf091fc2..188be66c 100644 --- a/src/lndk_offers.rs +++ b/src/lndk_offers.rs @@ -12,7 +12,8 @@ use lightning::offers::invoice_request::{InvoiceRequest, UnsignedInvoiceRequest} use lightning::offers::merkle::SignError; use lightning::offers::offer::{Amount, Offer}; use lightning::offers::parse::{Bolt12ParseError, Bolt12SemanticError}; -use lightning::onion_message::{Destination, OffersMessage, PendingOnionMessage}; +use lightning::onion_message::messenger::{Destination, PendingOnionMessage}; +use lightning::onion_message::offers::OffersMessage; use lightning::sign::EntropySource; use log::error; use std::error::Error; @@ -401,7 +402,7 @@ impl MessageSigner for Client { ) -> Result, Status> { let tag_vec = tag.as_bytes().to_vec(); let req = SignMessageReq { - msg: merkle_root.as_ref().to_vec(), + msg: >::as_ref(&merkle_root).to_vec(), tag: tag_vec, key_loc: Some(key_loc), schnorr_sig: true, diff --git a/src/onion_messenger.rs b/src/onion_messenger.rs index 283bde66..d36607c0 100644 --- a/src/onion_messenger.rs +++ b/src/onion_messenger.rs @@ -9,9 +9,10 @@ use bitcoin::secp256k1::PublicKey; use core::ops::Deref; use lightning::ln::features::InitFeatures; use lightning::ln::msgs::{Init, OnionMessage, OnionMessageHandler}; -use lightning::onion_message::{ - CustomOnionMessageHandler, MessageRouter, OffersMessageHandler, OnionMessenger, +use lightning::onion_message::messenger::{ + CustomOnionMessageHandler, MessageRouter, OnionMessenger, }; +use lightning::onion_message::offers::OffersMessageHandler; use lightning::sign::EntropySource; use lightning::sign::NodeSigner; use lightning::util::logger::{Level, Logger, Record}; @@ -83,7 +84,7 @@ impl EntropySource for MessengerUtilities { } impl Logger for MessengerUtilities { - fn log(&self, record: &Record) { + fn log(&self, record: Record) { let args_str = record.args.to_string(); match record.level { Level::Gossip => {} @@ -719,6 +720,7 @@ mod tests { use bitcoin::network::constants::Network; use bitcoin::secp256k1::PublicKey; use bytes::BufMut; + use lightning::events::{EventHandler, EventsProvider}; use lightning::ln::features::{InitFeatures, NodeFeatures}; use lightning::ln::msgs::{OnionMessage, OnionMessageHandler}; use lightning::util::ser::Readable; @@ -762,11 +764,24 @@ mod tests { fn next_onion_message_for_peer(&self, peer_node_id: PublicKey) -> Option; fn peer_connected(&self, their_node_id: &PublicKey, init: &Init, inbound: bool) -> Result<(), ()>; fn peer_disconnected(&self, their_node_id: &PublicKey); + fn timer_tick_occurred(&self); fn provided_node_features(&self) -> NodeFeatures; fn provided_init_features(&self, their_node_id: &PublicKey) -> InitFeatures; } } + // Mockall can't automatically produce a mock for EventsProvider since mockall requires generic parameters be + // 'static. See: https://docs.rs/mockall/latest/mockall/#generic-traits-and-structs. So we add the trait to our + // mock manually here. + impl EventsProvider for MockOnionHandler { + fn process_pending_events(&self, _handler: H) + where + H::Target: EventHandler, + { + todo!() + } + } + mock! { PeerProducer{} diff --git a/tests/integration_tests.rs b/tests/integration_tests.rs index 7e21ed60..da3c88e1 100644 --- a/tests/integration_tests.rs +++ b/tests/integration_tests.rs @@ -9,7 +9,7 @@ use chrono::Utc; use ldk_sample::node_api::Node as LdkNode; use lightning::blinded_path::BlindedPath; use lightning::offers::offer::Quantity; -use lightning::onion_message::Destination; +use lightning::onion_message::messenger::Destination; use lndk::onion_messenger::MessengerUtilities; use lndk::{LifecycleSignals, PayOfferParams}; use std::path::PathBuf; From c6c3e2144dcd7b5b681e75e66459decd618158a4 Mon Sep 17 00:00:00 2001 From: Orbital Date: Mon, 22 Jan 2024 16:28:57 -0600 Subject: [PATCH 6/7] offers: add InvoicePayer for paying an offer --- src/lnd.rs | 26 ++++- src/lndk_offers.rs | 229 ++++++++++++++++++++++++++++++++++++++++++++- 2 files changed, 251 insertions(+), 4 deletions(-) diff --git a/src/lnd.rs b/src/lnd.rs index 5c198cae..98b07fcc 100644 --- a/src/lnd.rs +++ b/src/lnd.rs @@ -5,8 +5,9 @@ use bitcoin::hashes::sha256::Hash; use bitcoin::network::constants::Network; use bitcoin::secp256k1::ecdh::SharedSecret; use bitcoin::secp256k1::ecdsa::{RecoverableSignature, Signature}; -use bitcoin::secp256k1::{self, PublicKey, Scalar, Secp256k1}; +use bitcoin::secp256k1::{self, Error as Secp256k1Error, PublicKey, Scalar, Secp256k1}; use futures::executor::block_on; +use lightning::blinded_path::BlindedPath; use lightning::ln::msgs::UnsignedGossipMessage; use lightning::offers::invoice::UnsignedBolt12Invoice; use lightning::offers::invoice_request::{InvoiceRequest, UnsignedInvoiceRequest}; @@ -16,7 +17,7 @@ use std::collections::HashMap; use std::error::Error; use std::fmt; use std::path::PathBuf; -use tonic_lnd::lnrpc::{LightningNode, ListPeersResponse}; +use tonic_lnd::lnrpc::{HtlcAttempt, LightningNode, ListPeersResponse, QueryRoutesResponse, Route}; use tonic_lnd::signrpc::KeyLocator; use tonic_lnd::tonic::Status; use tonic_lnd::{Client, ConnectError}; @@ -210,3 +211,24 @@ pub trait PeerConnector { async fn connect_peer(&mut self, node_id: String, addr: String) -> Result<(), Status>; async fn get_node_info(&mut self, pub_key: String) -> Result, Status>; } + +/// InvoicePayer provides a layer of abstraction over the LND API for paying for a BOLT 12 invoice. +#[async_trait] +pub trait InvoicePayer { + async fn query_routes( + &mut self, + path: BlindedPath, + cltv_expiry_delta: u16, + fee_base_msat: u32, + msats: u64, + ) -> Result; + async fn send_to_route( + &mut self, + payment_hash: [u8; 32], + route: Route, + ) -> Result; + async fn track_payment( + &mut self, + payment_hash: [u8; 32], + ) -> Result<(), OfferError>; +} diff --git a/src/lndk_offers.rs b/src/lndk_offers.rs index 188be66c..9180a22c 100644 --- a/src/lndk_offers.rs +++ b/src/lndk_offers.rs @@ -1,4 +1,4 @@ -use crate::lnd::{features_support_onion_messages, MessageSigner, PeerConnector}; +use crate::lnd::{features_support_onion_messages, InvoicePayer, MessageSigner, PeerConnector}; use crate::{OfferHandler, OfferState, PayOfferParams}; use async_trait::async_trait; use bitcoin::hashes::sha256::Hash; @@ -21,7 +21,11 @@ use std::fmt::Display; use std::str::FromStr; use tokio::sync::mpsc::Receiver; use tokio::task; -use tonic_lnd::lnrpc::{GetInfoRequest, LightningNode, ListPeersRequest, ListPeersResponse}; +use tonic_lnd::lnrpc::{ + GetInfoRequest, HtlcAttempt, LightningNode, ListPeersRequest, ListPeersResponse, + QueryRoutesResponse, Route, +}; +use tonic_lnd::routerrpc::TrackPaymentRequest; use tonic_lnd::signrpc::{KeyLocator, SignMessageReq}; use tonic_lnd::tonic::Status; use tonic_lnd::Client; @@ -49,6 +53,12 @@ pub enum OfferError { ListPeersFailure(Status), /// Failure to build a reply path. BuildBlindedPathFailure, + /// Unable to find or send to payment route. + RouteFailure(Status), + /// Failed to track payment. + TrackFailure(Status), + /// Failed to send payment. + PaymentFailure, } impl Display for OfferError { @@ -69,6 +79,9 @@ impl Display for OfferError { OfferError::NodeAddressNotFound => write!(f, "Couldn't get node address"), OfferError::ListPeersFailure(e) => write!(f, "Error listing peers: {e:?}"), OfferError::BuildBlindedPathFailure => write!(f, "Error building blinded path"), + OfferError::RouteFailure(e) => write!(f, "Error routing payment: {e:?}"), + OfferError::TrackFailure(e) => write!(f, "Error tracking payment: {e:?}"), + OfferError::PaymentFailure => write!(f, "Failed to send payment"), } } } @@ -246,6 +259,33 @@ impl OfferHandler { }))? } } + + /// pay_invoice tries to pay the provided invoice. + pub(crate) async fn pay_invoice( + &self, + mut payer: impl InvoicePayer + std::marker::Send + 'static, + path: BlindedPath, + cltv_expiry_delta: u16, + fee_base_msat: u32, + payment_hash: [u8; 32], + msats: u64, + ) -> Result<(), OfferError> { + let resp = payer + .query_routes(path, cltv_expiry_delta, fee_base_msat, msats) + .await + .map_err(OfferError::RouteFailure)?; + + let _ = payer + .send_to_route(payment_hash, resp.routes[0].clone()) + .await + .map_err(OfferError::RouteFailure)?; + + // The payment is still in flight. We'll track it until it settles. + payer + .track_payment(payment_hash) + .await + .map_err(|_| OfferError::PaymentFailure) + } } // Checks that the user-provided amount matches the offer. @@ -436,9 +476,97 @@ impl MessageSigner for Client { } } +#[async_trait] +impl InvoicePayer for Client { + async fn query_routes( + &mut self, + path: BlindedPath, + cltv_expiry_delta: u16, + fee_base_msat: u32, + msats: u64, + ) -> Result { + let mut blinded_hops = vec![]; + for hop in path.blinded_hops.iter() { + let new_hop = tonic_lnd::lnrpc::BlindedHop { + blinded_node: hop.blinded_node_id.serialize().to_vec(), + encrypted_data: hop.clone().encrypted_payload, + }; + blinded_hops.push(new_hop); + } + + let blinded_path = Some(tonic_lnd::lnrpc::BlindedPath { + introduction_node: path.introduction_node_id.serialize().to_vec(), + blinding_point: path.blinding_point.serialize().to_vec(), + blinded_hops, + }); + + let blinded_payment_paths = tonic_lnd::lnrpc::BlindedPaymentPath { + blinded_path, + total_cltv_delta: u32::from(cltv_expiry_delta) + 120, + base_fee_msat: u64::from(fee_base_msat), + ..Default::default() + }; + + let query_req = tonic_lnd::lnrpc::QueryRoutesRequest { + amt_msat: msats as i64, + blinded_payment_paths: vec![blinded_payment_paths], + ..Default::default() + }; + + let resp = self.lightning().query_routes(query_req).await?; + Ok(resp.into_inner()) + } + + async fn send_to_route( + &mut self, + payment_hash: [u8; 32], + route: Route, + ) -> Result { + let send_req = tonic_lnd::routerrpc::SendToRouteRequest { + payment_hash: payment_hash.to_vec(), + route: Some(route), + ..Default::default() + }; + + let resp = self.router().send_to_route_v2(send_req).await?; + Ok(resp.into_inner()) + } + + async fn track_payment( + &mut self, + payment_hash: [u8; 32], + ) -> Result<(), OfferError> { + let req = TrackPaymentRequest { + payment_hash: payment_hash.to_vec(), + no_inflight_updates: true, + }; + + let mut stream = self + .router() + .track_payment_v2(req) + .await + .map_err(OfferError::TrackFailure)? + .into_inner(); + + // Wait for a failed or successful payment. + while let Some(payment) = stream.message().await.map_err(OfferError::TrackFailure)? { + if payment.status() == tonic_lnd::lnrpc::payment::PaymentStatus::Succeeded { + return Ok(()); + } else if payment.status() == tonic_lnd::lnrpc::payment::PaymentStatus::Failed { + return Err(OfferError::PaymentFailure); + } else { + continue; + } + } + + Err(OfferError::PaymentFailure) + } +} + #[cfg(test)] mod tests { use super::*; + use crate::MessengerUtilities; use bitcoin::secp256k1::{Error as Secp256k1Error, KeyPair, Secp256k1, SecretKey}; use core::convert::Infallible; use lightning::offers::merkle::SignError; @@ -491,6 +619,17 @@ mod tests { .expect("failed verifying signature") } + fn get_blinded_path() -> BlindedPath { + let entropy_source = MessengerUtilities::new(); + let secp_ctx = Secp256k1::new(); + BlindedPath::new_for_message( + &[PublicKey::from_str(&get_pubkey()).unwrap()], + &entropy_source, + &secp_ctx, + ) + .unwrap() + } + mock! { TestBolt12Signer{} @@ -513,6 +652,17 @@ mod tests { } } + mock! { + TestInvoicePayer{} + + #[async_trait] + impl InvoicePayer for TestInvoicePayer{ + async fn query_routes(&mut self, path: BlindedPath, cltv_expiry_delta: u16, fee_base_msat: u32, msats: u64) -> Result; + async fn send_to_route(&mut self, payment_hash: [u8; 32], route: Route) -> Result; + async fn track_payment(&mut self, payment_hash: [u8; 32]) -> Result<(), OfferError>; + } + } + #[tokio::test] async fn test_request_invoice() { let mut signer_mock = MockTestBolt12Signer::new(); @@ -759,4 +909,79 @@ mod tests { .await .is_err()) } + + #[tokio::test] + async fn test_pay_invoice() { + let mut payer_mock = MockTestInvoicePayer::new(); + + payer_mock.expect_query_routes().returning(|_, _, _, _| { + let route = Route { + ..Default::default() + }; + Ok(QueryRoutesResponse { + routes: vec![route], + ..Default::default() + }) + }); + + payer_mock.expect_send_to_route().returning(|_, _| { + Ok(HtlcAttempt { + ..Default::default() + }) + }); + + payer_mock.expect_track_payment().returning(|_| Ok(())); + + let blinded_path = get_blinded_path(); + let payment_hash = MessengerUtilities::new().get_secure_random_bytes(); + let handler = OfferHandler::new(); + assert!(handler + .pay_invoice(payer_mock, blinded_path, 200, 1, payment_hash, 2000) + .await + .is_ok()); + } + + #[tokio::test] + async fn test_pay_invoice_query_error() { + let mut payer_mock = MockTestInvoicePayer::new(); + + payer_mock + .expect_query_routes() + .returning(|_, _, _, _| Err(Status::unknown("unknown error"))); + + let blinded_path = get_blinded_path(); + let payment_hash = MessengerUtilities::new().get_secure_random_bytes(); + let handler = OfferHandler::new(); + assert!(handler + .pay_invoice(payer_mock, blinded_path, 200, 1, payment_hash, 2000) + .await + .is_err()); + } + + #[tokio::test] + async fn test_pay_invoice_send_error() { + let mut payer_mock = MockTestInvoicePayer::new(); + + payer_mock.expect_query_routes().returning(|_, _, _, _| { + let route = Route { + ..Default::default() + }; + Ok(QueryRoutesResponse { + routes: vec![route], + ..Default::default() + }) + }); + + payer_mock + .expect_send_to_route() + .returning(|_, _| Err(Status::unknown("unknown error"))); + + let blinded_path = get_blinded_path(); + let payment_hash = MessengerUtilities::new().get_secure_random_bytes(); + let handler = OfferHandler::new(); + assert!(handler + .pay_invoice(payer_mock, blinded_path, 200, 1, payment_hash, 2000) + .await + .is_err()); + } } From 4b491cc7ffad42b477ea32b0cf7f02e2025555ec Mon Sep 17 00:00:00 2001 From: Orbital Date: Tue, 23 Jan 2024 14:34:54 -0600 Subject: [PATCH 7/7] multi: send offer payment --- src/lib.rs | 55 ++++++++++++-- src/lndk_offers.rs | 76 +++++++++++++------ tests/integration_tests.rs | 145 +++++++++++++++++++++++++++++++++++++ 3 files changed, 248 insertions(+), 28 deletions(-) diff --git a/src/lib.rs b/src/lib.rs index 263150c8..80e2c3e9 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -8,7 +8,7 @@ mod rate_limit; use crate::lnd::{ features_support_onion_messages, get_lnd_client, string_to_network, LndCfg, LndNodeSigner, }; -use crate::lndk_offers::OfferError; +use crate::lndk_offers::{OfferError, PayInvoiceParams}; use crate::onion_messenger::MessengerUtilities; use bitcoin::network::constants::Network; use bitcoin::secp256k1::{Error as Secp256k1Error, PublicKey, Secp256k1}; @@ -16,6 +16,7 @@ use home::home_dir; use lightning::blinded_path::BlindedPath; use lightning::ln::inbound_payment::ExpandedKey; use lightning::ln::peer_handler::IgnoringMessageHandler; +use lightning::offers::invoice::Bolt12Invoice; use lightning::offers::invoice_error::InvoiceError; use lightning::offers::offer::Offer; use lightning::onion_message::messenger::{ @@ -33,6 +34,7 @@ use std::collections::HashMap; use std::str::FromStr; use std::sync::{Mutex, Once}; use tokio::sync::mpsc::{Receiver, Sender}; +use tokio::time::{sleep, Duration}; use tonic_lnd::lnrpc::GetInfoRequest; use tonic_lnd::Client; use triggered::{Listener, Trigger}; @@ -189,6 +191,7 @@ enum OfferState { pub struct OfferHandler { active_offers: Mutex>, + active_invoices: Mutex>, pending_messages: Mutex>>, pub messenger_utils: MessengerUtilities, expanded_key: ExpandedKey, @@ -214,6 +217,7 @@ impl OfferHandler { OfferHandler { active_offers: Mutex::new(HashMap::new()), + active_invoices: Mutex::new(Vec::new()), pending_messages: Mutex::new(Vec::new()), messenger_utils, expanded_key, @@ -226,8 +230,42 @@ impl OfferHandler { cfg: PayOfferParams, started: Receiver, ) -> Result<(), OfferError> { - self.send_invoice_request(cfg, started).await?; - Ok(()) + let client_clone = cfg.client.clone(); + let offer_id = cfg.offer.clone().to_string(); + let validated_amount = self.send_invoice_request(cfg, started).await?; + + let invoice = self.wait_for_invoice().await; + { + let mut active_offers = self.active_offers.lock().unwrap(); + active_offers.insert(offer_id.clone(), OfferState::InvoiceReceived); + } + + let payment_hash = invoice.payment_hash(); + let path_info = invoice.payment_paths()[0].clone(); + + let params = PayInvoiceParams { + path: path_info.1, + cltv_expiry_delta: path_info.0.cltv_expiry_delta, + fee_base_msat: path_info.0.fee_base_msat, + payment_hash: payment_hash.0, + msats: validated_amount, + offer_id, + }; + + self.pay_invoice(client_clone, params).await + } + + /// wait_for_invoice waits for the offer creator to respond with an invoice. + async fn wait_for_invoice(&self) -> Bolt12Invoice { + loop { + { + let mut active_invoices = self.active_invoices.lock().unwrap(); + if active_invoices.len() == 1 { + return active_invoices.pop().unwrap(); + } + } + sleep(Duration::from_secs(2)).await; + } } } @@ -252,13 +290,20 @@ impl OffersMessageHandler for OfferHandler { // returned payment id below to check if we already processed an invoice for // this payment. Right now it's safe to let this be because we won't try to pay // a second invoice (if it comes through). - Ok(_payment_id) => Some(OffersMessage::Invoice(invoice)), + Ok(_payment_id) => { + let mut active_invoices = self.active_invoices.lock().unwrap(); + active_invoices.push(invoice.clone()); + Some(OffersMessage::Invoice(invoice)) + } Err(()) => Some(OffersMessage::InvoiceError(InvoiceError::from_string( String::from("invoice verification failure"), ))), } } - OffersMessage::InvoiceError(_error) => None, + OffersMessage::InvoiceError(error) => { + log::error!("Invoice error received: {}", error); + None + } } } diff --git a/src/lndk_offers.rs b/src/lndk_offers.rs index 9180a22c..102ea1e3 100644 --- a/src/lndk_offers.rs +++ b/src/lndk_offers.rs @@ -98,7 +98,7 @@ impl OfferHandler { &self, mut cfg: PayOfferParams, mut started: Receiver, - ) -> Result<(), OfferError> { + ) -> Result> { // Wait for onion messenger to give us the signal that it's ready. Once the onion messenger drops // the channel sender, recv will return None and we'll stop blocking here. if started.recv().await.is_some() { @@ -159,7 +159,7 @@ impl OfferHandler { pending_messages.push(pending_message); std::mem::drop(pending_messages); - Ok(()) + Ok(validated_amount) } // create_invoice_request builds and signs an invoice request, the first step in the BOLT 12 process of paying an offer. @@ -264,30 +264,45 @@ impl OfferHandler { pub(crate) async fn pay_invoice( &self, mut payer: impl InvoicePayer + std::marker::Send + 'static, - path: BlindedPath, - cltv_expiry_delta: u16, - fee_base_msat: u32, - payment_hash: [u8; 32], - msats: u64, + params: PayInvoiceParams, ) -> Result<(), OfferError> { let resp = payer - .query_routes(path, cltv_expiry_delta, fee_base_msat, msats) + .query_routes( + params.path, + params.cltv_expiry_delta, + params.fee_base_msat, + params.msats, + ) .await .map_err(OfferError::RouteFailure)?; let _ = payer - .send_to_route(payment_hash, resp.routes[0].clone()) + .send_to_route(params.payment_hash, resp.routes[0].clone()) .await .map_err(OfferError::RouteFailure)?; - // The payment is still in flight. We'll track it until it settles. + { + let mut active_offers = self.active_offers.lock().unwrap(); + active_offers.insert(params.offer_id, OfferState::InvoicePaymentDispatched); + } + + // We'll track the payment until it settles. payer - .track_payment(payment_hash) + .track_payment(params.payment_hash) .await .map_err(|_| OfferError::PaymentFailure) } } +pub struct PayInvoiceParams { + pub path: BlindedPath, + pub cltv_expiry_delta: u16, + pub fee_base_msat: u32, + pub payment_hash: [u8; 32], + pub msats: u64, + pub offer_id: String, +} + // Checks that the user-provided amount matches the offer. pub async fn validate_amount( offer: &Offer, @@ -935,10 +950,15 @@ mod tests { let blinded_path = get_blinded_path(); let payment_hash = MessengerUtilities::new().get_secure_random_bytes(); let handler = OfferHandler::new(); - assert!(handler - .pay_invoice(payer_mock, blinded_path, 200, 1, payment_hash, 2000) - .await - .is_ok()); + let params = PayInvoiceParams { + path: blinded_path, + cltv_expiry_delta: 200, + fee_base_msat: 1, + payment_hash: payment_hash, + msats: 2000, + offer_id: get_offer(), + }; + assert!(handler.pay_invoice(payer_mock, params).await.is_ok()); } #[tokio::test] @@ -952,10 +972,15 @@ mod tests { let blinded_path = get_blinded_path(); let payment_hash = MessengerUtilities::new().get_secure_random_bytes(); let handler = OfferHandler::new(); - assert!(handler - .pay_invoice(payer_mock, blinded_path, 200, 1, payment_hash, 2000) - .await - .is_err()); + let params = PayInvoiceParams { + path: blinded_path, + cltv_expiry_delta: 200, + fee_base_msat: 1, + payment_hash: payment_hash, + msats: 2000, + offer_id: get_offer(), + }; + assert!(handler.pay_invoice(payer_mock, params).await.is_err()); } #[tokio::test] @@ -979,9 +1004,14 @@ mod tests { let blinded_path = get_blinded_path(); let payment_hash = MessengerUtilities::new().get_secure_random_bytes(); let handler = OfferHandler::new(); - assert!(handler - .pay_invoice(payer_mock, blinded_path, 200, 1, payment_hash, 2000) - .await - .is_err()); + let params = PayInvoiceParams { + path: blinded_path, + cltv_expiry_delta: 200, + fee_base_msat: 1, + payment_hash: payment_hash, + msats: 2000, + offer_id: get_offer(), + }; + assert!(handler.pay_invoice(payer_mock, params).await.is_err()); } } diff --git a/tests/integration_tests.rs b/tests/integration_tests.rs index da3c88e1..a9a921ca 100644 --- a/tests/integration_tests.rs +++ b/tests/integration_tests.rs @@ -12,6 +12,7 @@ use lightning::offers::offer::Quantity; use lightning::onion_message::messenger::Destination; use lndk::onion_messenger::MessengerUtilities; use lndk::{LifecycleSignals, PayOfferParams}; +use std::net::SocketAddr; use std::path::PathBuf; use std::str::FromStr; use std::time::SystemTime; @@ -296,3 +297,147 @@ async fn test_lndk_send_invoice_request() { } } } + +#[tokio::test(flavor = "multi_thread")] +// Here we test that we're able to fully pay an offer. +async fn test_lndk_pay_offer() { + let test_name = "lndk_pay_offer"; + let (bitcoind, mut lnd, ldk1, ldk2, lndk_dir) = + common::setup_test_infrastructure(test_name).await; + + // Here we'll produce a little network of channels: + // + // ldk1 <- ldk2 <- lnd + // + // ldk1 will be the offer creator, which will build a blinded route from ldk2 to ldk1. + let (pubkey, addr) = ldk1.get_node_info(); + let (pubkey_2, addr_2) = ldk2.get_node_info(); + let lnd_info = lnd.get_info().await; + let lnd_pubkey = PublicKey::from_str(&lnd_info.identity_pubkey).unwrap(); + + ldk1.connect_to_peer(pubkey_2, addr_2).await.unwrap(); + lnd.connect_to_peer(pubkey_2, addr_2).await; + + let ldk2_fund_addr = ldk2.bitcoind_client.get_new_address().await; + let lnd_fund_addr = lnd.new_address().await.address; + + // We need to convert funding addresses to the form that the bitcoincore_rpc library recognizes. + let ldk2_addr_string = ldk2_fund_addr.to_string(); + let ldk2_addr = bitcoind::bitcoincore_rpc::bitcoin::Address::from_str(&ldk2_addr_string) + .unwrap() + .require_network(RpcNetwork::Regtest) + .unwrap(); + let lnd_addr = bitcoind::bitcoincore_rpc::bitcoin::Address::from_str(&lnd_fund_addr) + .unwrap() + .require_network(RpcNetwork::Regtest) + .unwrap(); + let lnd_network_addr = lnd + .address + .replace("localhost", "127.0.0.1") + .replace("https://", ""); + + // Fund both of these nodes, open the channels, and synchronize the network. + bitcoind + .node + .client + .generate_to_address(6, &lnd_addr) + .unwrap(); + + lnd.wait_for_chain_sync().await; + + ldk2.open_channel(pubkey, addr, 200000, 0, false) + .await + .unwrap(); + + lnd.wait_for_graph_sync().await; + + ldk2.open_channel( + lnd_pubkey, + SocketAddr::from_str(&lnd_network_addr).unwrap(), + 200000, + 10000000, + true, + ) + .await + .unwrap(); + + lnd.wait_for_graph_sync().await; + + bitcoind + .node + .client + .generate_to_address(20, &ldk2_addr) + .unwrap(); + + lnd.wait_for_chain_sync().await; + + let path_pubkeys = vec![pubkey_2, pubkey]; + let expiration = SystemTime::now() + Duration::from_secs(24 * 60 * 60); + let offer = ldk1 + .create_offer( + &path_pubkeys, + Network::Regtest, + 20_000, + Quantity::One, + expiration, + ) + .await + .expect("should create offer"); + + let (shutdown, listener) = triggered::trigger(); + let lnd_cfg = lndk::lnd::LndCfg::new( + lnd.address.clone(), + PathBuf::from_str(&lnd.cert_path).unwrap(), + PathBuf::from_str(&lnd.macaroon_path).unwrap(), + ); + let (tx, rx): (Sender, Receiver) = mpsc::channel(1); + + let signals = LifecycleSignals { + shutdown: shutdown.clone(), + listener, + started: tx, + }; + + let lndk_cfg = lndk::Cfg { + lnd: lnd_cfg, + log_dir: Some( + lndk_dir + .join(format!("lndk-logs.txt")) + .to_str() + .unwrap() + .to_string(), + ), + signals, + }; + + let messenger_utils = MessengerUtilities::new(); + let client = lnd.client.clone().unwrap(); + let blinded_path = offer.paths()[0].clone(); + let secp_ctx = Secp256k1::new(); + let reply_path = + BlindedPath::new_for_message(&[pubkey_2, lnd_pubkey], &messenger_utils, &secp_ctx).unwrap(); + + // Make sure lndk successfully sends the invoice_request. + let handler = lndk::OfferHandler::new(); + let messenger = lndk::LndkOnionMessenger::new(handler); + let pay_cfg = PayOfferParams { + offer, + amount: Some(20_000), + network: Network::Regtest, + client: client.clone(), + destination: Destination::BlindedPath(blinded_path.clone()), + reply_path: Some(reply_path), + }; + select! { + val = messenger.run(lndk_cfg) => { + panic!("lndk should not have completed first {:?}", val); + }, + // We wait for ldk2 to receive the onion message. + res = messenger.offer_handler.pay_offer(pay_cfg, rx) => { + assert!(res.is_ok()); + shutdown.trigger(); + ldk1.stop().await; + ldk2.stop().await; + } + } +}