it works, but this refactor ended up a lot slower

This commit is contained in:
Bryan Stitt 2022-05-04 05:49:12 +00:00
parent 24cdc0e7c1
commit 3b1ed9474c
3 changed files with 21 additions and 7 deletions

5
.gitignore vendored

@ -1,4 +1,5 @@
/target
/data/config/*.toml
/flamegraph.svg
/perf.data
/perf.data.old
/flamegraph.svg
/target

@ -5,12 +5,25 @@ listen_port = 8445
[balanced_rpc_tiers.0]
[balanced_rpc_tiers.0.local_erigon]
url = "ws://127.0.0.1:8545"
soft_limit = 68_000
[balanced_rpc_tiers.0.geth]
url = "ws://127.0.0.1:8546"
soft_limit = 50_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

@ -135,13 +135,13 @@ impl Web3Connection {
match &self.provider {
Web3Provider::Http(provider) => {
// TODO: there is a "watch_blocks" function, but a lot of public nodes do not support the necessary rpc endpoints
// there is a "watch_blocks" function, but a lot of public nodes do not support the necessary rpc endpoints
// TODO: what should this interval be? probably some fraction of block time
// TODO: maybe it would be better to have one interval for all of the http providers, but this works for now
let mut interval = interval(Duration::from_secs(2));
loop {
// wait for 2 seconds
// wait for the interval
interval.tick().await;
let block_number = provider.get_block_number().await.map(|x| x.as_u64())?;