dont subscribe to blocks on private rpcs
This commit is contained in:
parent
71ab993574
commit
927ec60183
@ -6,3 +6,20 @@
|
|||||||
url = "ws://127.0.0.1:8546"
|
url = "ws://127.0.0.1:8546"
|
||||||
soft_limit = 200_000
|
soft_limit = 200_000
|
||||||
|
|
||||||
|
[private_rpcs]
|
||||||
|
|
||||||
|
[private_rpcs.eden]
|
||||||
|
url = "https://api.edennetwork.io/v1/"
|
||||||
|
soft_limit = 1_805
|
||||||
|
|
||||||
|
[private_rpcs.eden_beta]
|
||||||
|
url = "https://api.edennetwork.io/v1/beta"
|
||||||
|
soft_limit = 5_861
|
||||||
|
|
||||||
|
[private_rpcs.ethermine]
|
||||||
|
url = "https://rpc.ethermine.org"
|
||||||
|
soft_limit = 5_861
|
||||||
|
|
||||||
|
[private_rpcs.flashbots]
|
||||||
|
url = "https://rpc.flashbots.net"
|
||||||
|
soft_limit = 7074
|
||||||
|
@ -85,6 +85,7 @@ impl Web3ProxyApp {
|
|||||||
balanced_rpc_tier,
|
balanced_rpc_tier,
|
||||||
Some(http_client.clone()),
|
Some(http_client.clone()),
|
||||||
&clock,
|
&clock,
|
||||||
|
true,
|
||||||
)
|
)
|
||||||
}))
|
}))
|
||||||
.await
|
.await
|
||||||
@ -103,6 +104,7 @@ impl Web3ProxyApp {
|
|||||||
private_rpcs,
|
private_rpcs,
|
||||||
Some(http_client),
|
Some(http_client),
|
||||||
&clock,
|
&clock,
|
||||||
|
false,
|
||||||
)
|
)
|
||||||
.await?,
|
.await?,
|
||||||
)
|
)
|
||||||
|
@ -65,6 +65,7 @@ impl Web3Connections {
|
|||||||
servers: Vec<Web3ConnectionConfig>,
|
servers: Vec<Web3ConnectionConfig>,
|
||||||
http_client: Option<reqwest::Client>,
|
http_client: Option<reqwest::Client>,
|
||||||
clock: &QuantaClock,
|
clock: &QuantaClock,
|
||||||
|
subscribe_heads: bool,
|
||||||
) -> anyhow::Result<Arc<Self>> {
|
) -> anyhow::Result<Arc<Self>> {
|
||||||
let mut connections = vec![];
|
let mut connections = vec![];
|
||||||
|
|
||||||
@ -85,6 +86,7 @@ impl Web3Connections {
|
|||||||
synced_connections: RwLock::new(SyncedConnections::new(num_connections)),
|
synced_connections: RwLock::new(SyncedConnections::new(num_connections)),
|
||||||
});
|
});
|
||||||
|
|
||||||
|
if subscribe_heads {
|
||||||
for connection in connections.inner.iter() {
|
for connection in connections.inner.iter() {
|
||||||
// subscribe to new heads in a spawned future
|
// subscribe to new heads in a spawned future
|
||||||
// TODO: channel instead. then we can have one future with write access to a left-right?
|
// TODO: channel instead. then we can have one future with write access to a left-right?
|
||||||
@ -99,6 +101,7 @@ impl Web3Connections {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
Ok(connections)
|
Ok(connections)
|
||||||
}
|
}
|
||||||
|
@ -62,7 +62,6 @@ impl<'de> Deserialize<'de> for JsonRpcRequestEnum {
|
|||||||
let mut batch: Vec<JsonRpcRequest> =
|
let mut batch: Vec<JsonRpcRequest> =
|
||||||
Vec::with_capacity(seq.size_hint().unwrap_or(10));
|
Vec::with_capacity(seq.size_hint().unwrap_or(10));
|
||||||
|
|
||||||
// this was easier than expected
|
|
||||||
while let Ok(Some(s)) = seq.next_element::<JsonRpcRequest>() {
|
while let Ok(Some(s)) = seq.next_element::<JsonRpcRequest>() {
|
||||||
batch.push(s);
|
batch.push(s);
|
||||||
}
|
}
|
||||||
@ -107,6 +106,7 @@ impl<'de> Deserialize<'de> for JsonRpcRequestEnum {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
let id = id.ok_or_else(|| de::Error::missing_field("id"))?;
|
let id = id.ok_or_else(|| de::Error::missing_field("id"))?;
|
||||||
let method = method.ok_or_else(|| de::Error::missing_field("method"))?;
|
let method = method.ok_or_else(|| de::Error::missing_field("method"))?;
|
||||||
let params = params.ok_or_else(|| de::Error::missing_field("params"))?;
|
let params = params.ok_or_else(|| de::Error::missing_field("params"))?;
|
||||||
|
Loading…
Reference in New Issue
Block a user