This is intended to be a safer way for functions to accept only a subset of sigversion values.
It’s intended to solve the uninitialized value warning seen here: #25972 (comment)
Now that all possible values in the enum class
are tested, there’s no need for a default case and thus the compiler should be able to deduce that there’s no way for this value to be used uninitialized.
Sadly it’s not possible to do any type of inheritance with an enum class
, so instead it’s faked by using std::underlying_type_t<SigVersion>
, which should ensure that it’s in sync with SigVersion
even if it changes in the future.
Imo this is safe enough that there’s no need for a default case as suggested here: #25972 (comment) , but that’s up for discussion here.
The second commit is simply a cleanup that removes the need to pass a sigversion to EvalChecksigTapscript because it’s only intended to ever be used with… tapscript.