MCPcopy Create free account
hub / github.com/ElementsProject/elements / FUZZ_TARGET

Function FUZZ_TARGET

src/test/fuzz/decode_tx.cpp:15–32  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

13#include <vector>
14
15FUZZ_TARGET(decode_tx)
16{
17 const std::string tx_hex = HexStr(buffer);
18 CMutableTransaction mtx;
19 const bool result_none = DecodeHexTx(mtx, tx_hex, false, false);
20 const bool result_try_witness = DecodeHexTx(mtx, tx_hex, false, true);
21 const bool result_try_witness_and_maybe_no_witness = DecodeHexTx(mtx, tx_hex, true, true);
22 CMutableTransaction no_witness_mtx;
23 const bool result_try_no_witness = DecodeHexTx(no_witness_mtx, tx_hex, true, false);
24 assert(!result_none);
25 if (result_try_witness_and_maybe_no_witness) {
26 assert(result_try_no_witness || result_try_witness);
27 }
28 if (result_try_no_witness) {
29 assert(!no_witness_mtx.HasWitness());
30 assert(result_try_witness_and_maybe_no_witness);
31 }
32}

Callers

nothing calls this directly

Calls 3

DecodeHexTxFunction · 0.85
HexStrFunction · 0.50
HasWitnessMethod · 0.45

Tested by

no test coverage detected