From: Valentine Wallace Date: Tue, 30 Mar 2021 18:56:55 +0000 (-0400) Subject: Update to RL master and fix PendingHTLCsForwardable X-Git-Url: http://git.bitcoin.ninja/?a=commitdiff_plain;h=b4a50585c59e578b89c959ed01def10d9def1b39;p=ldk-sample Update to RL master and fix PendingHTLCsForwardable --- diff --git a/Cargo.lock b/Cargo.lock index 7eec170..1fd4f83 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -256,6 +256,7 @@ checksum = "b7282d924be3275cec7f6756ff4121987bc6481325397dde6ba3e7802b1a8b1c" [[package]] name = "lightning" version = "0.0.13" +source = "git+https://github.com/rust-bitcoin/rust-lightning?rev=6fcac8bc65ed6d372e0b8c367e9934c754f99ff3#6fcac8bc65ed6d372e0b8c367e9934c754f99ff3" dependencies = [ "bitcoin", ] @@ -263,6 +264,7 @@ dependencies = [ [[package]] name = "lightning-background-processor" version = "0.0.13" +source = "git+https://github.com/rust-bitcoin/rust-lightning?rev=6fcac8bc65ed6d372e0b8c367e9934c754f99ff3#6fcac8bc65ed6d372e0b8c367e9934c754f99ff3" dependencies = [ "bitcoin", "lightning", @@ -272,6 +274,7 @@ dependencies = [ [[package]] name = "lightning-block-sync" version = "0.0.13" +source = "git+https://github.com/rust-bitcoin/rust-lightning?rev=6fcac8bc65ed6d372e0b8c367e9934c754f99ff3#6fcac8bc65ed6d372e0b8c367e9934c754f99ff3" dependencies = [ "bitcoin", "chunked_transfer", @@ -295,6 +298,7 @@ dependencies = [ [[package]] name = "lightning-net-tokio" version = "0.0.13" +source = "git+https://github.com/rust-bitcoin/rust-lightning?rev=6fcac8bc65ed6d372e0b8c367e9934c754f99ff3#6fcac8bc65ed6d372e0b8c367e9934c754f99ff3" dependencies = [ "bitcoin", "lightning", @@ -304,6 +308,7 @@ dependencies = [ [[package]] name = "lightning-persister" version = "0.0.13" +source = "git+https://github.com/rust-bitcoin/rust-lightning?rev=6fcac8bc65ed6d372e0b8c367e9934c754f99ff3#6fcac8bc65ed6d372e0b8c367e9934c754f99ff3" dependencies = [ "bitcoin", "libc", diff --git a/Cargo.toml b/Cargo.toml index 0b8434c..4ce68df 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -8,22 +8,22 @@ edition = "2018" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] -# lightning-background-processor = { git = "https://github.com/rust-bitcoin/rust-lightning", rev = "32f6205848806a3b2876a2ae36b1db7d5fa22f7d" } -lightning-background-processor = { path = "../rust-lightning/background-processor" } +lightning-background-processor = { git = "https://github.com/rust-bitcoin/rust-lightning", rev = "6fcac8bc65ed6d372e0b8c367e9934c754f99ff3" } +# lightning-background-processor = { path = "../rust-lightning/background-processor" } base64 = "0.13.0" bitcoin = "0.26" bitcoin-bech32 = "0.7" bech32 = "0.7" hex = "0.3" -# lightning = { git = "https://github.com/rust-bitcoin/rust-lightning", rev = "32f6205848806a3b2876a2ae36b1db7d5fa22f7d" } -lightning = { path = "../rust-lightning/lightning" } -# lightning-block-sync = { git = "https://github.com/rust-bitcoin/rust-lightning", features = ["rpc-client"], rev = "32f6205848806a3b2876a2ae36b1db7d5fa22f7d" } -lightning-block-sync = { path = "../rust-lightning/lightning-block-sync", features = ["rpc-client"] } +lightning = { git = "https://github.com/rust-bitcoin/rust-lightning", rev = "6fcac8bc65ed6d372e0b8c367e9934c754f99ff3" } +# lightning = { path = "../rust-lightning/lightning" } +lightning-block-sync = { git = "https://github.com/rust-bitcoin/rust-lightning", features = ["rpc-client"], rev = "6fcac8bc65ed6d372e0b8c367e9934c754f99ff3" } +# lightning-block-sync = { path = "../rust-lightning/lightning-block-sync", features = ["rpc-client"] } lightning-invoice = { git = "https://github.com/rust-bitcoin/rust-lightning-invoice", rev = "aa3a57b9dca5205fa25fa333a2db165d7e77b3b0" } -# lightning-net-tokio = { git = "https://github.com/rust-bitcoin/rust-lightning", rev = "32f6205848806a3b2876a2ae36b1db7d5fa22f7d" } -lightning-net-tokio = { path = "../rust-lightning/lightning-net-tokio" } -# lightning-persister = { git = "https://github.com/rust-bitcoin/rust-lightning", rev = "32f6205848806a3b2876a2ae36b1db7d5fa22f7d" } -lightning-persister = { path = "../rust-lightning/lightning-persister" } +lightning-net-tokio = { git = "https://github.com/rust-bitcoin/rust-lightning", rev = "6fcac8bc65ed6d372e0b8c367e9934c754f99ff3" } +# lightning-net-tokio = { path = "../rust-lightning/lightning-net-tokio" } +lightning-persister = { git = "https://github.com/rust-bitcoin/rust-lightning", rev = "6fcac8bc65ed6d372e0b8c367e9934c754f99ff3" } +# lightning-persister = { path = "../rust-lightning/lightning-persister" } time = "0.2" rand = "0.4" serde_json = { version = "1.0" } diff --git a/src/main.rs b/src/main.rs index ab95086..493a07e 100644 --- a/src/main.rs +++ b/src/main.rs @@ -235,9 +235,9 @@ async fn handle_ldk_events( Event::PendingHTLCsForwardable { time_forwardable } => { let forwarding_channel_manager = loop_channel_manager.clone(); tokio::spawn(async move { - let min = time_forwardable.as_secs(); - let seconds_to_sleep = thread_rng().gen_range(min, min * 5); - tokio::time::sleep(Duration::from_secs(seconds_to_sleep)).await; + let min = time_forwardable.as_millis() as u64; + let millis_to_sleep = thread_rng().gen_range(min, min * 5) as u64; + tokio::time::sleep(Duration::from_millis(millis_to_sleep)).await; forwarding_channel_manager.process_pending_htlc_forwards(); }); }