avoid crushes during the chill

Signed-off-by: Uncle Stretch <uncle.stretch@ghostchain.io>
This commit is contained in:
Uncle Stretch 2025-11-18 02:19:45 +03:00
parent 7f246d9a4e
commit 2483648b13
Signed by: str3tch
GPG Key ID: 84F3190747EE79AA
4 changed files with 20 additions and 23 deletions

View File

@ -2,7 +2,7 @@
name = "ghost-eye"
authors = ["str3tch <stretch@ghostchain.io>"]
description = "Application for interacting with Casper/Ghost nodes that are exposing RPC only to the localhost"
version = "0.3.77"
version = "0.3.78"
edition = "2021"
homepage = "https://git.ghostchain.io/ghostchain"
repository = "https://git.ghostchain.io/ghostchain/ghost-eye"

View File

@ -189,9 +189,7 @@ pub async fn get_last_updated(
.ok()
.map(|hex_string: String| {
let bytes = hex::decode(&hex_string[2..]).expect("Invalid hex string");
u64::decode(&mut bytes.as_slice())
.ok()
.unwrap_or_default()
u64::decode(&mut bytes.as_slice()).ok().unwrap_or_default()
})
.unwrap_or_default();
@ -219,9 +217,7 @@ pub async fn get_rate_limit_delay(
.ok()
.map(|hex_string: String| {
let bytes = hex::decode(&hex_string[2..]).expect("Invalid hex string");
u64::decode(&mut bytes.as_slice())
.ok()
.unwrap_or(5_000u64)
u64::decode(&mut bytes.as_slice()).ok().unwrap_or(5_000u64)
})
.unwrap_or(5_000u64);

View File

@ -277,8 +277,8 @@ impl Network {
}
TxStatus::InBestBlock(b) => self.action_tx.send(Action::EventLog(
format!(
"transaction {} included in the block header {}",
b.extrinsic_hash(),
"transaction {:?} included in the block header {}",
b,
b.block_hash()
),
ActionLevel::Info,
@ -380,8 +380,12 @@ impl Network {
.await?;
legacy_rpc_calls::get_last_updated(&self.action_tx, &self.rpc_client, chain_id)
.await?;
legacy_rpc_calls::get_rate_limit_delay(&self.action_tx, &self.rpc_client, chain_id)
.await?;
legacy_rpc_calls::get_rate_limit_delay(
&self.action_tx,
&self.rpc_client,
chain_id,
)
.await?;
}
Ok(())
}
@ -715,7 +719,7 @@ impl Network {
Action::ChillFrom(sender) => {
let sender_str = hex::encode(sender);
let maybe_nonce = self.senders.get_mut(&sender_str);
if let Ok(tx_progress) = predefined_txs::chill(
if let Ok(_) = predefined_txs::chill(
&self.action_tx,
&self.online_client_api,
&sender,
@ -723,11 +727,11 @@ impl Network {
)
.await
{
self.transactions_to_watch.push(TxToWatch {
tx_progress,
sender: sender_str,
target: ActionTarget::ValidatorLog,
});
self.action_tx.send(Action::EventLog(
format!("the chill state will be applied at the start of new era."),
ActionLevel::Info,
ActionTarget::ValidatorLog,
))?
}
Ok(())
}
@ -851,12 +855,8 @@ impl Network {
.await
}
Action::NullifyLastTimestamp(chain_id) => {
legacy_rpc_calls::set_last_timestamp(
&self.action_tx,
&self.rpc_client,
chain_id,
)
.await
legacy_rpc_calls::set_last_timestamp(&self.action_tx, &self.rpc_client, chain_id)
.await
}
_ => Ok(()),
}

View File

@ -0,0 +1 @@