add backup indicator to more logs

This commit is contained in:
Bryan Stitt 2023-01-19 18:14:47 -08:00
parent 2f8920085b
commit c3b53eb5f2
2 changed files with 19 additions and 8 deletions

@ -64,6 +64,7 @@ async fn run(
));
// wait until the app has seen its first consensus head block
// TODO: if backups were included, wait a little longer
let _ = spawned_app.app.head_block_receiver().changed().await;
// start the frontend port

@ -331,17 +331,20 @@ impl Web3Connections {
.synced_connections
.swap(Arc::new(new_synced_connections));
let includes_backups_str = if includes_backups { "B" } else { "" };
if let Some(consensus_saved_block) = consensus_head_block {
match &old_synced_connections.head_block {
None => {
debug!(
"first {}/{}/{}/{} block={}, rpc={}",
"first {}/{}/{}/{} block={}, rpc={} {}",
num_consensus_rpcs,
num_checked_rpcs,
num_active_rpcs,
total_rpcs,
consensus_saved_block,
rpc
rpc,
includes_backups_str,
);
if includes_backups {
@ -368,7 +371,7 @@ impl Web3Connections {
if consensus_saved_block.hash() == old_head_block.hash() {
// no change in hash. no need to use head_block_sender
debug!(
"con {}/{}/{}/{} con={} rpc={}@{}",
"con {}/{}/{}/{} con={} rpc={}@{} {}",
num_consensus_rpcs,
num_checked_rpcs,
num_active_rpcs,
@ -376,6 +379,7 @@ impl Web3Connections {
consensus_saved_block,
rpc,
rpc_head_str,
includes_backups_str,
)
} else {
// hash changed
@ -386,7 +390,7 @@ impl Web3Connections {
}
debug!(
"unc {}/{}/{}/{} con_head={} old={} rpc={}@{}",
"unc {}/{}/{}/{} con_head={} old={} rpc={}@{} {}",
num_consensus_rpcs,
num_checked_rpcs,
num_active_rpcs,
@ -395,6 +399,7 @@ impl Web3Connections {
old_head_block,
rpc,
rpc_head_str,
includes_backups_str,
);
let consensus_head_block = self
@ -411,7 +416,7 @@ impl Web3Connections {
// this is unlikely but possible
// TODO: better log
warn!(
"chain rolled back {}/{}/{}/{} con={} old={} rpc={}@{}",
"chain rolled back {}/{}/{}/{} con={} old={} rpc={}@{} {}",
num_consensus_rpcs,
num_checked_rpcs,
num_active_rpcs,
@ -420,6 +425,7 @@ impl Web3Connections {
old_head_block,
rpc,
rpc_head_str,
includes_backups_str,
);
if includes_backups {
@ -441,7 +447,7 @@ impl Web3Connections {
}
Ordering::Greater => {
debug!(
"new {}/{}/{}/{} con={} rpc={}@{}",
"new {}/{}/{}/{} con={} rpc={}@{} {}",
num_consensus_rpcs,
num_checked_rpcs,
num_active_rpcs,
@ -449,6 +455,7 @@ impl Web3Connections {
consensus_saved_block,
rpc,
rpc_head_str,
includes_backups_str,
);
if includes_backups {
@ -472,23 +479,25 @@ impl Web3Connections {
if num_checked_rpcs >= self.min_head_rpcs {
error!(
"non {}/{}/{}/{} rpc={}@{}",
"non {}/{}/{}/{} rpc={}@{} {}",
num_consensus_rpcs,
num_checked_rpcs,
num_active_rpcs,
total_rpcs,
rpc,
rpc_head_str,
includes_backups_str,
);
} else {
debug!(
"non {}/{}/{}/{} rpc={}@{}",
"non {}/{}/{}/{} rpc={}@{} {}",
num_consensus_rpcs,
num_checked_rpcs,
num_active_rpcs,
total_rpcs,
rpc,
rpc_head_str,
includes_backups_str,
);
}
}
@ -498,6 +507,7 @@ impl Web3Connections {
}
struct ConnectionsGroup {
/// TODO: this group might not actually include backups, but they were at leastchecked
includes_backups: bool,
rpc_name_to_hash: HashMap<String, H256>,
}