fix: better bootstrap error message (#71)
This commit is contained in:
parent
56d0ce5a72
commit
e801b0b926
|
@ -15,17 +15,17 @@ impl BlockNotFoundError {
|
|||
}
|
||||
|
||||
#[derive(Debug, Error)]
|
||||
#[error("rpc error on method: {method}, message: {message}")]
|
||||
pub struct RpcError {
|
||||
#[error("rpc error on method: {method}, message: {error}")]
|
||||
pub struct RpcError<E: ToString> {
|
||||
method: String,
|
||||
message: String,
|
||||
error: E,
|
||||
}
|
||||
|
||||
impl RpcError {
|
||||
pub fn new<E: ToString>(method: &str, err: E) -> Self {
|
||||
impl<E: ToString> RpcError<E> {
|
||||
pub fn new(method: &str, err: E) -> Self {
|
||||
Self {
|
||||
method: method.to_string(),
|
||||
message: err.to_string(),
|
||||
error: err,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -5,6 +5,7 @@ use std::time::UNIX_EPOCH;
|
|||
use blst::min_pk::{PublicKey, Signature};
|
||||
use blst::BLST_ERROR;
|
||||
use chrono::Duration;
|
||||
use eyre::eyre;
|
||||
use eyre::Result;
|
||||
use log::{debug, info};
|
||||
use ssz_rs::prelude::*;
|
||||
|
@ -43,7 +44,10 @@ impl<R: Rpc> ConsensusClient<R> {
|
|||
) -> Result<ConsensusClient<R>> {
|
||||
let rpc = R::new(rpc);
|
||||
|
||||
let mut bootstrap = rpc.get_bootstrap(checkpoint_block_root).await?;
|
||||
let mut bootstrap = rpc
|
||||
.get_bootstrap(checkpoint_block_root)
|
||||
.await
|
||||
.map_err(|_| eyre!("could not fetch bootstrap"))?;
|
||||
|
||||
let committee_valid = is_current_committee_proof_valid(
|
||||
&bootstrap.header,
|
||||
|
|
Loading…
Reference in New Issue