diff options
author | MarcoFalke <falke.marco@gmail.com> | 2021-05-17 10:05:06 +0200 |
---|---|---|
committer | MarcoFalke <falke.marco@gmail.com> | 2021-05-17 10:04:57 +0200 |
commit | fae4ee545a652cc2934773b0e1fdb9004b0c5ba6 (patch) | |
tree | 3bb7fea2599f753a9eb122fa024598110ff23d55 | |
parent | faacb7eadb04a8af666e7bb59bcd79915fe3a80a (diff) |
fuzz: Add missing CheckTransaction before CheckTxInputs
-rw-r--r-- | src/test/fuzz/coins_view.cpp | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/test/fuzz/coins_view.cpp b/src/test/fuzz/coins_view.cpp index 21dc80cc8d..878b5a27da 100644 --- a/src/test/fuzz/coins_view.cpp +++ b/src/test/fuzz/coins_view.cpp @@ -6,6 +6,7 @@ #include <chainparams.h> #include <chainparamsbase.h> #include <coins.h> +#include <consensus/tx_check.h> #include <consensus/tx_verify.h> #include <consensus/validation.h> #include <key.h> @@ -230,6 +231,11 @@ FUZZ_TARGET_INIT(coins_view, initialize_coins_view) // consensus/tx_verify.cpp:171: bool Consensus::CheckTxInputs(const CTransaction &, TxValidationState &, const CCoinsViewCache &, int, CAmount &): Assertion `!coin.IsSpent()' failed. return; } + TxValidationState dummy; + if (!CheckTransaction(transaction, dummy)) { + // It is not allowed to call CheckTxInputs if CheckTransaction failed + return; + } (void)Consensus::CheckTxInputs(transaction, state, coins_view_cache, fuzzed_data_provider.ConsumeIntegralInRange<int>(0, std::numeric_limits<int>::max()), tx_fee_out); assert(MoneyRange(tx_fee_out)); }, |