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:
Anthony Towns
2025-07-26 18:51:24 +10:00
parent a5ead122fe
commit bddcadee82
12 changed files with 100 additions and 25 deletions

View File

@@ -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;