Skip to content

Commit

Permalink
remove unwrap and take ProviderBuilder outside of the spawn task
Browse files Browse the repository at this point in the history
Signed-off-by: 7suyash7 <[email protected]>
  • Loading branch information
7suyash7 committed Jan 6, 2025
1 parent 128bf11 commit 406f7c2
Showing 1 changed file with 6 additions and 13 deletions.
19 changes: 6 additions & 13 deletions crates/rbuilder/src/live_builder/order_input/txpool_fetcher.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,20 +24,13 @@ pub async fn subscribe_to_txpool_with_blobs(
results: mpsc::Sender<ReplaceableOrderPoolCommand>,
global_cancel: CancellationToken,
) -> eyre::Result<JoinHandle<()>> {
let handle = tokio::spawn(async move {
let provider = ProviderBuilder::new()
.on_ipc(IpcConnect::new(config.ipc_path.unwrap()))
.await;

let provider = match provider {
Ok(provider) => provider,
Err(err) => {
error!(?err, "Failed to connect to IPC");
global_cancel.cancel();
return;
}
};
let ipc_path = config
.ipc_path
.ok_or_else(|| eyre::eyre!("No IPC path configured"))?;
let ipc = IpcConnect::new(ipc_path);
let provider = ProviderBuilder::new().on_ipc(ipc).await?;

let handle = tokio::spawn(async move {
info!("Subscribe to txpool with blobs: started");

let stream = match provider.subscribe_pending_transactions().await {
Expand Down

0 comments on commit 406f7c2

Please sign in to comment.