tests: Fill fuzzing coverage gaps for functions in consensus/validation.h
This commit is contained in:
parent
c0bbf8193d
commit
b74f3d6c45
1 changed files with 5 additions and 0 deletions
|
@ -38,12 +38,17 @@ void test_one_input(const std::vector<uint8_t>& buffer)
|
||||||
const Consensus::Params& consensus_params = Params().GetConsensus();
|
const Consensus::Params& consensus_params = Params().GetConsensus();
|
||||||
BlockValidationState validation_state_pow_and_merkle;
|
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);
|
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;
|
BlockValidationState validation_state_pow;
|
||||||
const bool valid_incl_pow = CheckBlock(block, validation_state_pow, consensus_params, /* fCheckPOW= */ true, /* fCheckMerkleRoot= */ false);
|
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;
|
BlockValidationState validation_state_merkle;
|
||||||
const bool valid_incl_merkle = CheckBlock(block, validation_state_merkle, consensus_params, /* fCheckPOW= */ false, /* fCheckMerkleRoot= */ true);
|
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;
|
BlockValidationState validation_state_none;
|
||||||
const bool valid_incl_none = CheckBlock(block, validation_state_none, consensus_params, /* fCheckPOW= */ false, /* fCheckMerkleRoot= */ false);
|
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) {
|
if (valid_incl_pow_and_merkle) {
|
||||||
assert(valid_incl_pow && valid_incl_merkle && valid_incl_none);
|
assert(valid_incl_pow && valid_incl_merkle && valid_incl_none);
|
||||||
} else if (valid_incl_merkle || valid_incl_pow) {
|
} else if (valid_incl_merkle || valid_incl_pow) {
|
||||||
|
|
Loading…
Reference in a new issue