Merge 7d19c85f4a into merged_master (Bitcoin PR bitcoin/bitcoin#21970)

This commit is contained in:
Andrew Poelstra 2021-07-11 15:08:31 +00:00
commit ff432ef70e
2 changed files with 11 additions and 2 deletions

View file

@ -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>
@ -239,6 +240,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;
}
std::vector<std::pair<CScript, CScript>> fedpegscripts; // ELEMENTS: we ought to populate this and have a more useful fuzztest
std::set<std::pair<uint256, COutPoint> > setPeginsSpent;
(void)Consensus::CheckTxInputs(transaction, state, coins_view_cache, fuzzed_data_provider.ConsumeIntegralInRange<int>(0, std::numeric_limits<int>::max()), tx_fee_map, setPeginsSpent, NULL, false, true, fedpegscripts);

View file

@ -63,8 +63,11 @@ FUZZ_TARGET_INIT(transaction, initialize_transaction)
return;
}
TxValidationState state_with_dupe_check;
(void)CheckTransaction(tx, state_with_dupe_check);
{
TxValidationState state_with_dupe_check;
const bool res{CheckTransaction(tx, state_with_dupe_check)};
Assert(res == state_with_dupe_check.IsValid());
}
const CFeeRate dust_relay_fee{DUST_RELAY_TX_FEE};
std::string reason;