-
Notifications
You must be signed in to change notification settings - Fork 110
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Makes
equihash::Solution
an enum to support Regtest solutions, adds…
… a test for validating and committing the Regtest genesis block
- Loading branch information
Showing
5 changed files
with
83 additions
and
24 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,19 @@ | ||
//! Regtest genesis block | ||
use std::sync::Arc; | ||
|
||
use hex::FromHex; | ||
|
||
use crate::{block::Block, serialization::ZcashDeserializeInto}; | ||
|
||
/// Genesis block for Regtest, copied from zcashd via `getblock 0 0` RPC method | ||
pub fn regtest_genesis_block() -> Block { | ||
pub fn regtest_genesis_block() -> Arc<Block> { | ||
let regtest_genesis_block_bytes = | ||
<Vec<u8>>::from_hex(include_str!("genesis/block-regtest-0-000-000.txt").trim()) | ||
.expect("Block bytes are in valid hex representation"); | ||
|
||
regtest_genesis_block_bytes | ||
.zcash_deserialize_into() | ||
.map(Arc::new) | ||
.expect("hard-coded Regtest genesis block data must deserialize successfully") | ||
} |
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