From 848eb613497a998d733d2b081b8c91ea35788d40 Mon Sep 17 00:00:00 2001 From: Bryan Stitt Date: Thu, 20 Oct 2022 07:03:58 +0000 Subject: [PATCH] null private transactions instead of empty --- web3_proxy/src/app.rs | 10 +++++++--- web3_proxy/src/rpcs/connections.rs | 2 +- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/web3_proxy/src/app.rs b/web3_proxy/src/app.rs index 627c7170..af00b240 100644 --- a/web3_proxy/src/app.rs +++ b/web3_proxy/src/app.rs @@ -359,10 +359,14 @@ impl Web3ProxyApp { .await .context("spawning private_rpcs")?; - // save the handle to catch any errors - handles.push(private_handle); + if private_rpcs.conns.len() == 0 { + None + } else { + // save the handle to catch any errors + handles.push(private_handle); - Some(private_rpcs) + Some(private_rpcs) + } }; // create rate limiters diff --git a/web3_proxy/src/rpcs/connections.rs b/web3_proxy/src/rpcs/connections.rs index 28af4ae3..a51e51c4 100644 --- a/web3_proxy/src/rpcs/connections.rs +++ b/web3_proxy/src/rpcs/connections.rs @@ -38,7 +38,7 @@ use tracing::{error, info, instrument, trace, warn}; /// A collection of web3 connections. Sends requests either the current best server or all servers. #[derive(From)] pub struct Web3Connections { - pub(super) conns: HashMap>, + pub(crate) conns: HashMap>, /// any requests will be forwarded to one (or more) of these connections pub(super) synced_connections: ArcSwap, pub(super) pending_transactions: