From a8cf122ef7b1baa849a754da7696b39b5c1758f1 Mon Sep 17 00:00:00 2001 From: yukang Date: Sun, 15 Dec 2024 21:27:47 +0800 Subject: [PATCH] Fix compiling warning for rustc 1.81 --- src/fiber/channel.rs | 12 ++++++------ src/rpc/mod.rs | 8 ++++---- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/fiber/channel.rs b/src/fiber/channel.rs index f0aa15a67..32f68508c 100644 --- a/src/fiber/channel.rs +++ b/src/fiber/channel.rs @@ -1103,7 +1103,7 @@ where "Signing commitment transactions while shutdown is pending, current state {:?}", &state.state ); - CommitmentSignedFlags::PendingShutdown(flags) + CommitmentSignedFlags::PendingShutdown() } else { return Err(ProcessingChannelError::InvalidState(format!( "Unable to process commitment_signed message in shutdowning state with flags {:?}", @@ -1173,7 +1173,7 @@ where state.maybe_transition_to_tx_signatures(flags, &self.network)?; } CommitmentSignedFlags::ChannelReady() => {} - CommitmentSignedFlags::PendingShutdown(_) => { + CommitmentSignedFlags::PendingShutdown() => { state.maybe_transition_to_shutdown(&self.network)?; } } @@ -3072,7 +3072,7 @@ bitflags! { #[derive(Debug)] enum CommitmentSignedFlags { SigningCommitment(SigningCommitmentFlags), - PendingShutdown(ShuttingDownFlags), + PendingShutdown(), ChannelReady(), } @@ -5192,7 +5192,7 @@ impl ChannelActorState { "Signing commitment transactions while shutdown is pending, current state {:?}", &self.state ); - CommitmentSignedFlags::PendingShutdown(flags) + CommitmentSignedFlags::PendingShutdown() } else { return Err(ProcessingChannelError::InvalidState(format!( "Unable to process commitment_signed message in shutdowning state with flags {:?}", @@ -5246,11 +5246,11 @@ impl ChannelActorState { self.update_state(ChannelState::SigningCommitment(flags)); self.maybe_transition_to_tx_signatures(flags, network)?; } - CommitmentSignedFlags::ChannelReady() | CommitmentSignedFlags::PendingShutdown(_) => { + CommitmentSignedFlags::ChannelReady() | CommitmentSignedFlags::PendingShutdown() => { self.send_revoke_and_ack_message(network); match flags { CommitmentSignedFlags::ChannelReady() => {} - CommitmentSignedFlags::PendingShutdown(_) => { + CommitmentSignedFlags::PendingShutdown() => { // TODO: Handle error in the below function call. // We've already updated our state, we should never fail here. self.maybe_transition_to_shutdown(network)?; diff --git a/src/rpc/mod.rs b/src/rpc/mod.rs index 99aff8fd3..38e780be5 100644 --- a/src/rpc/mod.rs +++ b/src/rpc/mod.rs @@ -32,8 +32,8 @@ use tokio::sync::{mpsc::Sender, RwLock}; pub type InvoiceCommandWithReply = (InvoiceCommand, Sender>); -fn build_server(addr: &str) -> Server { - #[cfg(not(release))] +async fn build_server(addr: &str) -> Server { + #[cfg(debug_assertions)] { // Use socket2 to set reuse address and reuse port, // so that we can restart the server without waiting for the port to be released. @@ -56,7 +56,7 @@ fn build_server(addr: &str) -> Server { .build_from_tcp(socket) .expect("JsonRPC server built from TCP") } - #[cfg(release)] + #[cfg(not(debug_assertions))] { Server::builder() .build(addr) @@ -76,7 +76,7 @@ pub async fn start_rpc< network_graph: Arc>>, ) -> ServerHandle { let listening_addr = config.listening_addr.as_deref().unwrap_or("[::]:0"); - let server = build_server(listening_addr); + let server = build_server(listening_addr).await; let mut methods = InvoiceRpcServerImpl::new(store.clone(), fiber_config).into_rpc(); if let Some(network_actor) = network_actor { let info = InfoRpcServerImpl::new(network_actor.clone(), store.clone());