mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-01-20 15:19:07 +01:00
script/verify_flags: make script_verify_flags type safe
`using script_verify_flags = uint32_t` allows implicit conversion to and from int, so replace it with a class to have the compiler ensure we use the correct type. Provide from_int and as_int to allow for explicit conversions when desired. Introduces the type `script_verify_flag_name` for the individual flag name enumeration.
This commit is contained in:
@@ -15,6 +15,14 @@
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
|
||||
static DataStream& operator>>(DataStream& ds, script_verify_flags& f)
|
||||
{
|
||||
script_verify_flags::value_type n{0};
|
||||
ds >> n;
|
||||
f = script_verify_flags::from_int(n);
|
||||
return ds;
|
||||
}
|
||||
|
||||
FUZZ_TARGET(script_flags)
|
||||
{
|
||||
if (buffer.size() > 100'000) return;
|
||||
|
||||
Reference in New Issue
Block a user