diff --git a/crates/floresta-cli/src/main.rs b/crates/floresta-cli/src/main.rs index 3995a4f6..2adff954 100644 --- a/crates/floresta-cli/src/main.rs +++ b/crates/floresta-cli/src/main.rs @@ -82,7 +82,7 @@ fn get_req(cmd: &Cli) -> (Vec>, String) { Methods::RescanBlockchain { start_height } => vec![arg(start_height)], Methods::SendRawTransaction { tx } => vec![arg(tx)], Methods::GetRoots => Vec::new(), - Methods::GetBlock { hash } => vec![arg(hash)], + Methods::GetBlock { hash, verbosity } => vec![arg(hash), arg(verbosity)], Methods::GetPeerInfo => Vec::new(), Methods::ListTransactions => Vec::new(), Methods::Stop => Vec::new(), @@ -159,7 +159,7 @@ pub enum Methods { GetRoots, /// Returns a block #[command(name = "getblock")] - GetBlock { hash: BlockHash }, + GetBlock { hash: BlockHash, verbosity: u32 }, /// Returns information about the peers we are connected to #[command(name = "getpeerinfo")] GetPeerInfo, diff --git a/florestad/src/json_rpc/server.rs b/florestad/src/json_rpc/server.rs index 4fb3c765..7f678ac4 100644 --- a/florestad/src/json_rpc/server.rs +++ b/florestad/src/json_rpc/server.rs @@ -308,9 +308,11 @@ impl Rpc for RpcImpl { }) .collect(); last_block_times.sort(); - - let median_time_past = last_block_times[5]; - + let median_time_past = if last_block_times.len() > 5 { + last_block_times[5] + } else { + 0 + }; let block = BlockJson { bits: block.header.bits.to_hex(), chainwork: block.header.work().to_string(),