serialize best_rpcs

This commit is contained in:
Bryan Stitt 2023-03-22 14:23:14 -07:00
parent 8eff48611c
commit a69737db98
3 changed files with 6 additions and 4 deletions

View File

@ -565,6 +565,8 @@ These are not ordered. I think some rows also accidently got deleted here. Check
- look at average request time for getBlock? i'm not sure how good a proxy that will be for serving eth_call, but its a start
- https://crates.io/crates/histogram-sampler
- [ ] interval for http subscriptions should be based on block time. load from config is easy, but better to query. currently hard coded to 13 seconds
- [ ] check code to keep us from going backwards. maybe that is causing outages
- [ ] min_backup_rpcs seperate from min_synced_rpcs
in another repo: event subscriber
- [ ] watch for transfer events to our contract and submit them to /payment/$tx_hash

View File

@ -517,7 +517,7 @@ impl Web3Rpcs {
// this is unlikely but possible
// TODO: better log
warn!(
"chain rolled back t{}/{} {}{}/{}/{} con={} old={} rpc={}@{}",
"chain rolled back {}/{} {}{}/{}/{} con={} old={} rpc={}@{}",
consensus_tier,
total_tiers,
backups_voted_str,

View File

@ -7,7 +7,7 @@ use anyhow::Context;
use ethers::prelude::{H256, U64};
use hashbrown::{HashMap, HashSet};
use itertools::{Itertools, MinMaxResult};
use log::{trace, warn};
use log::{trace, warn, debug};
use moka::future::Cache;
use serde::Serialize;
use std::cmp::Reverse;
@ -21,8 +21,6 @@ use tokio::time::Instant;
pub struct ConsensusWeb3Rpcs {
pub(super) tier: u64,
pub(super) head_block: Web3ProxyBlock,
// TODO: this should be able to serialize, but it isn't
#[serde(skip_serializing)]
pub(super) best_rpcs: Vec<Arc<Web3Rpc>>,
// TODO: functions like "compare_backup_vote()"
// pub(super) backups_voted: Option<Web3ProxyBlock>,
@ -323,6 +321,8 @@ impl ConsensusFinder {
continue;
}
trace!("rpc_names: {:#?}", rpc_names);
// consensus likely found! load the rpcs to make sure they all have active connections
let consensus_rpcs: Vec<_> = rpc_names.into_iter().filter_map(|x| web3_rpcs.get(x)).collect();