-
Notifications
You must be signed in to change notification settings - Fork 106
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
change(rpc): Populate
blockcommitmenthash
and defaultroot
fields …
…in the getblocktemplate RPC (#5751) * populate `blockcommitmenthash` and `defaultroot` missing fields * remove assertion line manually from snaps * fix some imports and docs * fix some docs * add a consistency check * Rename a constant to FINALIZED_STATE_QUERY_RETRIES and use it everywhere * Move tip query inside retry, split tip into tip_height and tip_hash * Return retry failures rather than panicking * Query relevant chain inside the retry * Check the entire state for consistency, not just the finalized tip Co-authored-by: teor <[email protected]>
- Loading branch information
1 parent
4664ab2
commit 678c519
Showing
17 changed files
with
267 additions
and
110 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,4 +2,6 @@ | |
mod prop; | ||
mod snapshot; | ||
#[cfg(feature = "getblocktemplate-rpcs")] | ||
pub mod utils; | ||
mod vectors; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
//! Utility functions for RPC method tests. | ||
use std::sync::Arc; | ||
use zebra_chain::{ | ||
block::Block, | ||
history_tree::{HistoryTree, NonEmptyHistoryTree}, | ||
parameters::Network, | ||
sapling::tree::Root, | ||
serialization::ZcashDeserialize, | ||
}; | ||
|
||
use zebra_test::vectors; | ||
|
||
/// Create a history tree with one single block for a network by using Zebra test vectors. | ||
pub fn fake_history_tree(network: Network) -> Arc<HistoryTree> { | ||
let (block, sapling_root) = match network { | ||
Network::Mainnet => ( | ||
&vectors::BLOCK_MAINNET_1046400_BYTES[..], | ||
*vectors::SAPLING_FINAL_ROOT_MAINNET_1046400_BYTES, | ||
), | ||
Network::Testnet => ( | ||
&vectors::BLOCK_TESTNET_1116000_BYTES[..], | ||
*vectors::SAPLING_FINAL_ROOT_TESTNET_1116000_BYTES, | ||
), | ||
}; | ||
|
||
let block = Arc::<Block>::zcash_deserialize(block).expect("block should deserialize"); | ||
let first_sapling_root = Root::try_from(sapling_root).unwrap(); | ||
|
||
let history_tree = NonEmptyHistoryTree::from_block( | ||
Network::Mainnet, | ||
block, | ||
&first_sapling_root, | ||
&Default::default(), | ||
) | ||
.unwrap(); | ||
|
||
Arc::new(HistoryTree::from(history_tree)) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.