Skip to content

Commit

Permalink
expose some unexposed values for jsonrpc
Browse files Browse the repository at this point in the history
  • Loading branch information
Davidson-Souza committed Dec 1, 2023
1 parent f28b87f commit 711778e
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
4 changes: 2 additions & 2 deletions crates/floresta-cli/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ fn get_req(cmd: &Cli) -> (Vec<Box<RawValue>>, 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(),
Expand Down Expand Up @@ -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,
Expand Down
8 changes: 5 additions & 3 deletions florestad/src/json_rpc/server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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(),
Expand Down

0 comments on commit 711778e

Please sign in to comment.