fix: prevent progress bar from panicking using workaround (#6940)
* fix: prevent progress bar from panicking using workaround * remove more progress bar lengths * re-add set_len() calls commented out; restore one that shouldn't cause panics * Update zebra-state/src/service/non_finalized_state.rs Co-authored-by: teor <teor@riseup.net> --------- Co-authored-by: teor <teor@riseup.net>
This commit is contained in:
parent
4323097794
commit
fd78556000
|
|
@ -98,19 +98,17 @@ impl AddressBookUpdater {
|
||||||
let address_info = *address_info.borrow_and_update();
|
let address_info = *address_info.borrow_and_update();
|
||||||
|
|
||||||
address_bar
|
address_bar
|
||||||
.set_pos(u64::try_from(address_info.num_addresses).expect("fits in u64"))
|
.set_pos(u64::try_from(address_info.num_addresses).expect("fits in u64"));
|
||||||
.set_len(u64::try_from(address_info.address_limit).expect("fits in u64"));
|
// .set_len(u64::try_from(address_info.address_limit).expect("fits in u64"));
|
||||||
|
|
||||||
let never_attempted = address_info.never_attempted_alternate
|
let never_attempted = address_info.never_attempted_alternate
|
||||||
+ address_info.never_attempted_gossiped;
|
+ address_info.never_attempted_gossiped;
|
||||||
|
|
||||||
never_bar
|
never_bar.set_pos(u64::try_from(never_attempted).expect("fits in u64"));
|
||||||
.set_pos(u64::try_from(never_attempted).expect("fits in u64"))
|
// .set_len(u64::try_from(address_info.address_limit).expect("fits in u64"));
|
||||||
.set_len(u64::try_from(address_info.address_limit).expect("fits in u64"));
|
|
||||||
|
|
||||||
failed_bar
|
failed_bar.set_pos(u64::try_from(address_info.failed).expect("fits in u64"));
|
||||||
.set_pos(u64::try_from(address_info.failed).expect("fits in u64"))
|
// .set_len(u64::try_from(address_info.address_limit).expect("fits in u64"));
|
||||||
.set_len(u64::try_from(address_info.address_limit).expect("fits in u64"));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -115,8 +115,8 @@ impl ActiveConnectionCounter {
|
||||||
|
|
||||||
#[cfg(feature = "progress-bar")]
|
#[cfg(feature = "progress-bar")]
|
||||||
self.connection_bar
|
self.connection_bar
|
||||||
.set_pos(u64::try_from(self.count).expect("fits in u64"))
|
.set_pos(u64::try_from(self.count).expect("fits in u64"));
|
||||||
.set_len(u64::try_from(self.limit).expect("fits in u64"));
|
// .set_len(u64::try_from(self.limit).expect("fits in u64"));
|
||||||
|
|
||||||
self.count
|
self.count
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -662,9 +662,8 @@ impl NonFinalizedState {
|
||||||
.best_chain()
|
.best_chain()
|
||||||
.map(|chain| chain.non_finalized_root_height().0 - 1);
|
.map(|chain| chain.non_finalized_root_height().0 - 1);
|
||||||
|
|
||||||
chain_count_bar
|
chain_count_bar.set_pos(u64::try_from(self.chain_count()).expect("fits in u64"));
|
||||||
.set_pos(u64::try_from(self.chain_count()).expect("fits in u64"))
|
// .set_len(u64::try_from(MAX_NON_FINALIZED_CHAIN_FORKS).expect("fits in u64"));
|
||||||
.set_len(u64::try_from(MAX_NON_FINALIZED_CHAIN_FORKS).expect("fits in u64"));
|
|
||||||
|
|
||||||
if let Some(finalized_tip_height) = finalized_tip_height {
|
if let Some(finalized_tip_height) = finalized_tip_height {
|
||||||
chain_count_bar.desc(format!("Finalized Root {finalized_tip_height}"));
|
chain_count_bar.desc(format!("Finalized Root {finalized_tip_height}"));
|
||||||
|
|
@ -701,10 +700,11 @@ impl NonFinalizedState {
|
||||||
// - the chain this bar was previously assigned to might have changed position.
|
// - the chain this bar was previously assigned to might have changed position.
|
||||||
chain_length_bar
|
chain_length_bar
|
||||||
.label(format!("Fork {fork_height}"))
|
.label(format!("Fork {fork_height}"))
|
||||||
.set_pos(u64::try_from(chain.len()).expect("fits in u64"))
|
.set_pos(u64::try_from(chain.len()).expect("fits in u64"));
|
||||||
.set_len(u64::from(
|
// TODO: should this be MAX_BLOCK_REORG_HEIGHT?
|
||||||
zebra_chain::transparent::MIN_TRANSPARENT_COINBASE_MATURITY,
|
// .set_len(u64::from(
|
||||||
));
|
// zebra_chain::transparent::MIN_TRANSPARENT_COINBASE_MATURITY,
|
||||||
|
// ));
|
||||||
|
|
||||||
// display work as bits
|
// display work as bits
|
||||||
let mut desc = format!(
|
let mut desc = format!(
|
||||||
|
|
|
||||||
|
|
@ -411,41 +411,29 @@ impl Mempool {
|
||||||
|| self.transaction_cost_bar.is_none()
|
|| self.transaction_cost_bar.is_none()
|
||||||
|| self.rejected_count_bar.is_none())
|
|| self.rejected_count_bar.is_none())
|
||||||
{
|
{
|
||||||
let max_transaction_count = self.config.tx_cost_limit
|
let _max_transaction_count = self.config.tx_cost_limit
|
||||||
/ zebra_chain::transaction::MEMPOOL_TRANSACTION_COST_THRESHOLD;
|
/ zebra_chain::transaction::MEMPOOL_TRANSACTION_COST_THRESHOLD;
|
||||||
|
|
||||||
self.queued_count_bar = Some(
|
self.queued_count_bar = Some(*howudoin::new().label("Mempool Queue").set_pos(0u64));
|
||||||
howudoin::new()
|
// .set_len(
|
||||||
.label("Mempool Queue")
|
// u64::try_from(downloads::MAX_INBOUND_CONCURRENCY).expect("fits in u64"),
|
||||||
.set_pos(0u64)
|
// ),
|
||||||
.set_len(
|
|
||||||
u64::try_from(downloads::MAX_INBOUND_CONCURRENCY).expect("fits in u64"),
|
|
||||||
),
|
|
||||||
);
|
|
||||||
|
|
||||||
self.transaction_count_bar = Some(
|
self.transaction_count_bar = Some(*howudoin::new().label("Mempool Txs").set_pos(0u64));
|
||||||
howudoin::new()
|
// .set_len(max_transaction_count),
|
||||||
.label("Mempool Txs")
|
|
||||||
.set_pos(0u64)
|
|
||||||
.set_len(max_transaction_count),
|
|
||||||
);
|
|
||||||
|
|
||||||
self.transaction_cost_bar = Some(
|
self.transaction_cost_bar = Some(
|
||||||
howudoin::new()
|
howudoin::new()
|
||||||
.label("Mempool Cost")
|
.label("Mempool Cost")
|
||||||
.set_pos(0u64)
|
.set_pos(0u64)
|
||||||
.set_len(self.config.tx_cost_limit)
|
// .set_len(self.config.tx_cost_limit)
|
||||||
.fmt_as_bytes(true),
|
.fmt_as_bytes(true),
|
||||||
);
|
);
|
||||||
|
|
||||||
self.rejected_count_bar = Some(
|
self.rejected_count_bar = Some(*howudoin::new().label("Mempool Rejects").set_pos(0u64));
|
||||||
howudoin::new()
|
// .set_len(
|
||||||
.label("Mempool Rejects")
|
// u64::try_from(storage::MAX_EVICTION_MEMORY_ENTRIES).expect("fits in u64"),
|
||||||
.set_pos(0u64)
|
// ),
|
||||||
.set_len(
|
|
||||||
u64::try_from(storage::MAX_EVICTION_MEMORY_ENTRIES).expect("fits in u64"),
|
|
||||||
),
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Update if the mempool has ever been active
|
// Update if the mempool has ever been active
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue