Rename TEST_BLOCKS to BLOCKS
To avoid confusion with TESTNET_BLOCKS. Automated search and replace, made using this script: sed -i 's/TEST_BLOCKS/BLOCKS/' \ $(grep -r TEST_BLOCKS zebra* | cut -d: -f1 | sort -u)
This commit is contained in:
parent
a35f36dd0b
commit
58041d8a49
|
|
@ -63,7 +63,7 @@ fn deserialize_block() {
|
||||||
.zcash_deserialize_into::<Block>()
|
.zcash_deserialize_into::<Block>()
|
||||||
.expect("block test vector should deserialize");
|
.expect("block test vector should deserialize");
|
||||||
|
|
||||||
for block in zebra_test::vectors::TEST_BLOCKS.iter() {
|
for block in zebra_test::vectors::BLOCKS.iter() {
|
||||||
block
|
block
|
||||||
.zcash_deserialize_into::<Block>()
|
.zcash_deserialize_into::<Block>()
|
||||||
.expect("block is structurally valid");
|
.expect("block is structurally valid");
|
||||||
|
|
@ -72,8 +72,8 @@ fn deserialize_block() {
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn block_test_vectors_unique() {
|
fn block_test_vectors_unique() {
|
||||||
let block_count = zebra_test::vectors::TEST_BLOCKS.len();
|
let block_count = zebra_test::vectors::BLOCKS.len();
|
||||||
let block_hashes: HashSet<_> = zebra_test::vectors::TEST_BLOCKS
|
let block_hashes: HashSet<_> = zebra_test::vectors::BLOCKS
|
||||||
.iter()
|
.iter()
|
||||||
.map(|b| {
|
.map(|b| {
|
||||||
b.zcash_deserialize_into::<Block>()
|
b.zcash_deserialize_into::<Block>()
|
||||||
|
|
|
||||||
|
|
@ -36,7 +36,7 @@ prop_compose! {
|
||||||
fn equihash_prop_test_solution() -> color_eyre::eyre::Result<()> {
|
fn equihash_prop_test_solution() -> color_eyre::eyre::Result<()> {
|
||||||
zebra_test::init();
|
zebra_test::init();
|
||||||
|
|
||||||
for block_bytes in zebra_test::vectors::TEST_BLOCKS.iter() {
|
for block_bytes in zebra_test::vectors::BLOCKS.iter() {
|
||||||
let block = Block::zcash_deserialize(&block_bytes[..])
|
let block = Block::zcash_deserialize(&block_bytes[..])
|
||||||
.expect("block test vector should deserialize");
|
.expect("block test vector should deserialize");
|
||||||
block.header.solution.check(&block.header)?;
|
block.header.solution.check(&block.header)?;
|
||||||
|
|
@ -68,7 +68,7 @@ prop_compose! {
|
||||||
fn equihash_prop_test_nonce() -> color_eyre::eyre::Result<()> {
|
fn equihash_prop_test_nonce() -> color_eyre::eyre::Result<()> {
|
||||||
zebra_test::init();
|
zebra_test::init();
|
||||||
|
|
||||||
for block_bytes in zebra_test::vectors::TEST_BLOCKS.iter() {
|
for block_bytes in zebra_test::vectors::BLOCKS.iter() {
|
||||||
let block = Block::zcash_deserialize(&block_bytes[..])
|
let block = Block::zcash_deserialize(&block_bytes[..])
|
||||||
.expect("block test vector should deserialize");
|
.expect("block test vector should deserialize");
|
||||||
block.header.solution.check(&block.header)?;
|
block.header.solution.check(&block.header)?;
|
||||||
|
|
@ -103,7 +103,7 @@ prop_compose! {
|
||||||
fn equihash_prop_test_input() -> color_eyre::eyre::Result<()> {
|
fn equihash_prop_test_input() -> color_eyre::eyre::Result<()> {
|
||||||
zebra_test::init();
|
zebra_test::init();
|
||||||
|
|
||||||
for block_bytes in zebra_test::vectors::TEST_BLOCKS.iter() {
|
for block_bytes in zebra_test::vectors::BLOCKS.iter() {
|
||||||
let block = Block::zcash_deserialize(&block_bytes[..])
|
let block = Block::zcash_deserialize(&block_bytes[..])
|
||||||
.expect("block test vector should deserialize");
|
.expect("block test vector should deserialize");
|
||||||
block.header.solution.check(&block.header)?;
|
block.header.solution.check(&block.header)?;
|
||||||
|
|
|
||||||
|
|
@ -9,7 +9,7 @@ use std::iter::FromIterator;
|
||||||
lazy_static! {
|
lazy_static! {
|
||||||
|
|
||||||
/// All block test vectors
|
/// All block test vectors
|
||||||
pub static ref TEST_BLOCKS: Vec<&'static [u8]> = MAINNET_BLOCKS.iter().chain(TESTNET_BLOCKS.iter()).map(|(_height, block)| *block).collect();
|
pub static ref BLOCKS: Vec<&'static [u8]> = MAINNET_BLOCKS.iter().chain(TESTNET_BLOCKS.iter()).map(|(_height, block)| *block).collect();
|
||||||
|
|
||||||
// Update these lists of blocks when you add new block test vectors to
|
// Update these lists of blocks when you add new block test vectors to
|
||||||
// this file
|
// this file
|
||||||
|
|
@ -323,8 +323,8 @@ mod test {
|
||||||
|
|
||||||
#[test]
|
#[test]
|
||||||
fn block_test_vectors_unique() {
|
fn block_test_vectors_unique() {
|
||||||
let block_count = TEST_BLOCKS.len();
|
let block_count = BLOCKS.len();
|
||||||
let block_set: HashSet<_> = TEST_BLOCKS.iter().collect();
|
let block_set: HashSet<_> = BLOCKS.iter().collect();
|
||||||
|
|
||||||
// putting the same block in two files is an easy mistake to make
|
// putting the same block in two files is an easy mistake to make
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
|
|
@ -340,7 +340,7 @@ mod test {
|
||||||
#[test]
|
#[test]
|
||||||
fn block_test_vectors_count() {
|
fn block_test_vectors_count() {
|
||||||
assert!(
|
assert!(
|
||||||
TEST_BLOCKS.len() > 50,
|
BLOCKS.len() > 50,
|
||||||
"there should be a reasonable number of block test vectors"
|
"there should be a reasonable number of block test vectors"
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue