diff options
author | Sjors Provoost <sjors@sprovoost.nl> | 2017-11-09 12:02:46 +0100 |
---|---|---|
committer | Sjors Provoost <sjors@sprovoost.nl> | 2017-11-09 12:02:46 +0100 |
commit | 12781db0585ed7ddcfd7134bc2a0cbabb4de21e3 (patch) | |
tree | 2f890bdb735840b440c0ee9c8bd61ce1af3f3573 /src/univalue | |
parent | f7388e93d3dd91a90239aedac4ec58404f103a2e (diff) |
[Tests] check specific validation error in miner tests
BOOST_CHECK_THROW merely checks that some std::runtime_error is
thrown, but not which one.
One example of how this could lead to a test passing when a developer
introduces a consensus bug: the test for the sigops limit assumes
that CreateNewBlock fails with bad-blk-sigops. However it can
also fail with bad-txns-vout-negative, e.g. if a naive developer lowers
BLOCKSUBSIDY to 1*COIN in the test.
BOOST_CHECK_EXCEPTION allows an additional predicate function. This
commit uses this for all exceptions that are checked for in
miner_tets.cpp:
* bad-blk-sigops
* bad-cb-multiple
* bad-txns-inputs-missingorspent
* block-validation-failed
An instance of the CheckRejectInvalid class (for a given validation string)
is passed to BOOST_CHECK_EXCEPTION.
Diffstat (limited to 'src/univalue')
0 files changed, 0 insertions, 0 deletions