From b02e35aa5780648a3d5e38ea97a8444aea5da452 Mon Sep 17 00:00:00 2001 From: thedevbirb Date: Fri, 13 Dec 2024 11:03:12 +0100 Subject: [PATCH] chore(sidecar): cleanup --- bolt-sidecar/src/api/commitments/firewall_recv.rs | 5 +++-- bolt-sidecar/src/driver.rs | 5 +++-- bolt-sidecar/src/primitives/commitment.rs | 1 + 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/bolt-sidecar/src/api/commitments/firewall_recv.rs b/bolt-sidecar/src/api/commitments/firewall_recv.rs index 46d9402d..79d2f31d 100644 --- a/bolt-sidecar/src/api/commitments/firewall_recv.rs +++ b/bolt-sidecar/src/api/commitments/firewall_recv.rs @@ -203,7 +203,8 @@ struct CommitmentRequestProcessor { /// NOTE: Is there a better way to avoid this monster type? /// SAFETY: the `poll` implementation of this struct promptly handles these responses and /// ensures this vector doesn't grow indefinitely. - pending_commitment_responses: FuturesUnordered>>, + pending_commitment_responses: + FuturesUnordered>>, /// The collection of outgoing messages to be sent to the connected websocket server. outgoing_messages: VecDeque, } @@ -268,7 +269,7 @@ impl Future for CommitmentRequestProcessor { } // add the pending response to this buffer for later processing - this.pending_commitment_responses.push(rx.boxed()); + this.pending_commitment_responses.push(rx); } Ok(Message::Close(_)) => { warn!(?rpc_url, "websocket connection closed by server"); diff --git a/bolt-sidecar/src/driver.rs b/bolt-sidecar/src/driver.rs index 94cda59b..48096db2 100644 --- a/bolt-sidecar/src/driver.rs +++ b/bolt-sidecar/src/driver.rs @@ -40,6 +40,8 @@ use crate::{ LocalBuilder, }; +const API_EVENTS_BUFFER_SIZE: usize = 1024; + /// The driver for the sidecar, responsible for managing the main event loop. /// /// The reponsibilities of the driver include: @@ -159,7 +161,6 @@ impl SidecarDriver { commitment_signer: ECDSA, fetcher: C, ) -> eyre::Result { - println!("opts {:#?}", opts); let mut constraints_client = ConstraintsClient::new(opts.constraints_api_url.clone()); // read the delegations from disk if they exist and add them to the constraints client. @@ -241,7 +242,7 @@ impl SidecarDriver { let port = opts.commitment_opts.port.unwrap_or(DEFAULT_RPC_PORT); // start the commitments api server let api_addr = format!("0.0.0.0:{}", port); - let (api_events_tx, api_events_rx) = mpsc::channel(1024); + let (api_events_tx, api_events_rx) = mpsc::channel(API_EVENTS_BUFFER_SIZE); CommitmentsApiServer::new(api_addr).run(api_events_tx, opts.limits).await; api_events_rx }; diff --git a/bolt-sidecar/src/primitives/commitment.rs b/bolt-sidecar/src/primitives/commitment.rs index bcdb246f..2cea34f2 100644 --- a/bolt-sidecar/src/primitives/commitment.rs +++ b/bolt-sidecar/src/primitives/commitment.rs @@ -41,6 +41,7 @@ pub struct InclusionCommitment { signature: Signature, } +#[cfg(test)] impl InclusionCommitment { /// Creates a new unchecked inclusion commitment pub fn new_unchecked(request: InclusionRequest, signature: Signature) -> Self {