mirror of
https://github.com/bitcoin/bitcoin.git
synced 2024-11-20 02:25:40 +01:00
tests: Fuzz additional functions in the transaction fuzzing harness
This commit is contained in:
parent
1d324ce922
commit
5fc10f3cb5
@ -2,6 +2,7 @@
|
||||
// Distributed under the MIT software license, see the accompanying
|
||||
// file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
||||
|
||||
#include <chainparams.h>
|
||||
#include <coins.h>
|
||||
#include <consensus/tx_check.h>
|
||||
#include <consensus/tx_verify.h>
|
||||
@ -13,12 +14,18 @@
|
||||
#include <primitives/transaction.h>
|
||||
#include <streams.h>
|
||||
#include <test/fuzz/fuzz.h>
|
||||
#include <univalue.h>
|
||||
#include <util/rbf.h>
|
||||
#include <validation.h>
|
||||
#include <version.h>
|
||||
|
||||
#include <cassert>
|
||||
|
||||
void initialize()
|
||||
{
|
||||
SelectParams(CBaseChainParams::REGTEST);
|
||||
}
|
||||
|
||||
void test_one_input(const std::vector<uint8_t>& buffer)
|
||||
{
|
||||
CDataStream ds(buffer, SER_NETWORK, INIT_PROTO_VERSION);
|
||||
@ -85,4 +92,21 @@ void test_one_input(const std::vector<uint8_t>& buffer)
|
||||
(void)IsStandardTx(tx, reason);
|
||||
(void)RecursiveDynamicUsage(tx);
|
||||
(void)SignalsOptInRBF(tx);
|
||||
|
||||
CCoinsView coins_view;
|
||||
const CCoinsViewCache coins_view_cache(&coins_view);
|
||||
(void)AreInputsStandard(tx, coins_view_cache);
|
||||
(void)IsWitnessStandard(tx, coins_view_cache);
|
||||
|
||||
UniValue u(UniValue::VOBJ);
|
||||
// ValueFromAmount(i) not defined when i == std::numeric_limits<int64_t>::min()
|
||||
bool skip_tx_to_univ = false;
|
||||
for (const CTxOut& txout : tx.vout) {
|
||||
if (txout.nValue == std::numeric_limits<int64_t>::min()) {
|
||||
skip_tx_to_univ = true;
|
||||
}
|
||||
}
|
||||
if (!skip_tx_to_univ) {
|
||||
TxToUniv(tx, /* hashBlock */ {}, u);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user