-
Notifications
You must be signed in to change notification settings - Fork 117
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
change(consensus): Refactor production code for network consensus rul…
…es to `Network` methods (#8340) * begin refactor suggested as "step 2": #7968 (comment) Squashed from multiple commits to enable partial rebase * break out more little traits * add activation implementation leveraging From<Network> for lrz::cons:: * for transfer of ownership I cannot return a type that's owned by the method * hrp_sapling_extended_full_viewing_key * complete implementation of interface of Parameters on Network reuse Parameters on zcash Network where possible * move doc-comments to trait declarations (from impls) * Simplify/complete Parameters impl for Network * Add checkpoint_list method, move documentation, etc * move last match network to inside network method * add back comment * use zcash_address for parameter types in zebra-chain * use inherent methods instead of big parameters passthrough * revert to implementation of From on zcash_primitives::..::Network vs &zcash_prim... * move match * add test to block maximum time rule * update changelog * finish porting target_difficutly_limit * remove obscelete code comment * revert non-functional change * finish migrating target_difficulty_limit, checkpoint_list * update changelog --------- Co-authored-by: Hazel OHearn <[email protected]>
- Loading branch information
Showing
32 changed files
with
284 additions
and
243 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
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 |
---|---|---|
@@ -1,21 +1,7 @@ | ||
//! Genesis consensus parameters for each Zcash network. | ||
use crate::{block, parameters::Network}; | ||
|
||
/// The previous block hash for the genesis block. | ||
/// | ||
/// All known networks use the Bitcoin `null` value for the parent of the | ||
/// genesis block. (In Bitcoin, `null` is `[0; 32]`.) | ||
pub const GENESIS_PREVIOUS_BLOCK_HASH: block::Hash = block::Hash([0; 32]); | ||
|
||
/// Returns the hash for the genesis block in `network`. | ||
pub fn genesis_hash(network: Network) -> block::Hash { | ||
match network { | ||
// zcash-cli getblockhash 0 | ||
Network::Mainnet => "00040fe8ec8471911baa1db1266ea15dd06b4a8a5c453883c000b031973dce08", | ||
// zcash-cli -testnet getblockhash 0 | ||
Network::Testnet => "05a60a92d99d85997cce3b87616c089f6124d7342af37106edc76126334a2c38", | ||
} | ||
.parse() | ||
.expect("hard-coded hash parses") | ||
} | ||
pub const GENESIS_PREVIOUS_BLOCK_HASH: crate::block::Hash = crate::block::Hash([0; 32]); |
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.