File tree Expand file tree Collapse file tree 1 file changed +18
-0
lines changed Expand file tree Collapse file tree 1 file changed +18
-0
lines changed Original file line number Diff line number Diff line change 7
7
8
8
#include < attributes.h>
9
9
#include < optional.h>
10
+ #include < script/script.h>
10
11
#include < serialize.h>
11
12
#include < streams.h>
12
13
#include < test/fuzz/FuzzedDataProvider.h>
14
+ #include < test/fuzz/fuzz.h>
13
15
#include < version.h>
14
16
15
17
#include < cstdint>
@@ -36,4 +38,20 @@ NODISCARD inline Optional<T> ConsumeDeserializable(FuzzedDataProvider& fuzzed_da
36
38
return obj;
37
39
}
38
40
41
+ NODISCARD inline opcodetype ConsumeOpcodeType (FuzzedDataProvider& fuzzed_data_provider) noexcept
42
+ {
43
+ return static_cast <opcodetype>(fuzzed_data_provider.ConsumeIntegralInRange <uint32_t >(0 , MAX_OPCODE));
44
+ }
45
+
46
+ NODISCARD inline CScript ConsumeScript (FuzzedDataProvider& fuzzed_data_provider) noexcept
47
+ {
48
+ const std::vector<uint8_t > b = ConsumeRandomLengthByteVector (fuzzed_data_provider);
49
+ return {b.begin (), b.end ()};
50
+ }
51
+
52
+ NODISCARD inline CScriptNum ConsumeScriptNum (FuzzedDataProvider& fuzzed_data_provider) noexcept
53
+ {
54
+ return CScriptNum{fuzzed_data_provider.ConsumeIntegral <int64_t >()};
55
+ }
56
+
39
57
#endif // BITCOIN_TEST_FUZZ_UTIL_H
You can’t perform that action at this time.
0 commit comments