X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=blobdiff_plain;f=src%2Fmain.rs;h=5f5dc0af87324ba4bf416829d8ea2fa1446036b0;hb=80357570090fdbe4be7e98660d70184173da77f8;hp=ab9508672d6483ac82384eef39fa49d3492a62d7;hpb=678119951c5b3460d24da64d0f2d755ef4f198e6;p=ldk-sample diff --git a/src/main.rs b/src/main.rs index ab95086..5f5dc0a 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(); }); } @@ -256,7 +256,6 @@ async fn handle_ldk_events( ) .unwrap(); bitcoind_client.broadcast_transaction(&spending_tx); - // XXX maybe need to rescan and blah? } } } @@ -264,8 +263,7 @@ async fn handle_ldk_events( } } -#[tokio::main] -pub async fn main() { +async fn start_ldk() { let args = match cli::parse_startup_args() { Ok(user_args) => user_args, Err(()) => return, @@ -573,3 +571,8 @@ pub async fn main() { ) .await; } + +#[tokio::main] +pub async fn main() { + start_ldk().await; +}