diff options
author | practicalswift <practicalswift@users.noreply.github.com> | 2020-05-09 21:27:15 +0000 |
---|---|---|
committer | practicalswift <practicalswift@users.noreply.github.com> | 2020-05-14 18:45:42 +0000 |
commit | b74f3d6c452d9ad7013c70a91216220917978f66 (patch) | |
tree | 653448ab0d3b2d818415f78e128bfc71adde962a /src/test/fuzz/block.cpp | |
parent | c0bbf8193d92ba85d62092c4fd886ff4461f65bf (diff) | |
download | bitcoin-b74f3d6c452d9ad7013c70a91216220917978f66.tar.xz |
tests: Fill fuzzing coverage gaps for functions in consensus/validation.h
Diffstat (limited to 'src/test/fuzz/block.cpp')
-rw-r--r-- | src/test/fuzz/block.cpp | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/src/test/fuzz/block.cpp b/src/test/fuzz/block.cpp index f30fa03e0b..91bd34a251 100644 --- a/src/test/fuzz/block.cpp +++ b/src/test/fuzz/block.cpp @@ -38,12 +38,17 @@ void test_one_input(const std::vector<uint8_t>& buffer) const Consensus::Params& consensus_params = Params().GetConsensus(); BlockValidationState validation_state_pow_and_merkle; const bool valid_incl_pow_and_merkle = CheckBlock(block, validation_state_pow_and_merkle, consensus_params, /* fCheckPOW= */ true, /* fCheckMerkleRoot= */ true); + assert(validation_state_pow_and_merkle.IsValid() || validation_state_pow_and_merkle.IsInvalid() || validation_state_pow_and_merkle.IsError()); + (void)validation_state_pow_and_merkle.Error(""); BlockValidationState validation_state_pow; const bool valid_incl_pow = CheckBlock(block, validation_state_pow, consensus_params, /* fCheckPOW= */ true, /* fCheckMerkleRoot= */ false); + assert(validation_state_pow.IsValid() || validation_state_pow.IsInvalid() || validation_state_pow.IsError()); BlockValidationState validation_state_merkle; const bool valid_incl_merkle = CheckBlock(block, validation_state_merkle, consensus_params, /* fCheckPOW= */ false, /* fCheckMerkleRoot= */ true); + assert(validation_state_merkle.IsValid() || validation_state_merkle.IsInvalid() || validation_state_merkle.IsError()); BlockValidationState validation_state_none; const bool valid_incl_none = CheckBlock(block, validation_state_none, consensus_params, /* fCheckPOW= */ false, /* fCheckMerkleRoot= */ false); + assert(validation_state_none.IsValid() || validation_state_none.IsInvalid() || validation_state_none.IsError()); if (valid_incl_pow_and_merkle) { assert(valid_incl_pow && valid_incl_merkle && valid_incl_none); } else if (valid_incl_merkle || valid_incl_pow) { |