Skip to content

Commit

Permalink
- get_block_header_info() back to verbosity 1
Browse files Browse the repository at this point in the history
- new function get_block_header_info_full() to use verbosity 2
verbosity 2 is very substantially slower
  • Loading branch information
Danconnolly committed Mar 10, 2024
1 parent 89a2fd5 commit 49ffdf8
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
8 changes: 8 additions & 0 deletions client/src/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -270,6 +270,14 @@ pub trait RpcApi: Sized {
fn get_block_header_info(
&self,
hash: &BlockHash,
) -> Result<json::GetBlockHeaderResult> {
self.call("getblockheader", &[into_json(hash)?, 1.into()])
}

/// Returns information about the block header, including merkle-root and coinbase tx.
fn get_block_header_info_full(
&self,
hash: &BlockHash,
) -> Result<json::GetBlockHeaderResult> {
self.call("getblockheader", &[into_json(hash)?, 2.into()])
}
Expand Down
4 changes: 2 additions & 2 deletions json/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -340,9 +340,9 @@ pub struct GetBlockHeaderResult {
pub next_block_hash: Option<BlockHash>,
pub status: GetBlockResultStatus,
#[serde(rename = "tx")]
pub coinbase_tx: Vec<GetRawTransactionResult>, /// its a vector but it only has one value
pub coinbase_tx: Option<Vec<GetRawTransactionResult>>, // its a vector but it only has one value
#[serde(rename = "merkleproof")]
pub coinbase_merkle_proof: Vec<Hash>,
pub coinbase_merkle_proof: Option<Vec<Hash>>,
}

#[derive(Clone, PartialEq, Debug, Deserialize, Serialize)]
Expand Down

0 comments on commit 49ffdf8

Please sign in to comment.