Skip to content

Commit

Permalink
chore(sidecar): cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
thedevbirb committed Dec 13, 2024
1 parent 8dd1932 commit b02e35a
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 4 deletions.
5 changes: 3 additions & 2 deletions bolt-sidecar/src/api/commitments/firewall_recv.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<Pin<Box<PendingCommitmentResult>>>,
pending_commitment_responses:
FuturesUnordered<oneshot::Receiver<Result<SignedCommitment, CommitmentError>>>,
/// The collection of outgoing messages to be sent to the connected websocket server.
outgoing_messages: VecDeque<Message>,
}
Expand Down Expand Up @@ -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");
Expand Down
5 changes: 3 additions & 2 deletions bolt-sidecar/src/driver.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -159,7 +161,6 @@ impl<C: StateFetcher, ECDSA: SignerECDSA> SidecarDriver<C, ECDSA> {
commitment_signer: ECDSA,
fetcher: C,
) -> eyre::Result<Self> {
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.
Expand Down Expand Up @@ -241,7 +242,7 @@ impl<C: StateFetcher, ECDSA: SignerECDSA> SidecarDriver<C, ECDSA> {
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
};
Expand Down
1 change: 1 addition & 0 deletions bolt-sidecar/src/primitives/commitment.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit b02e35a

Please sign in to comment.