According to BIP 141, the version range is 0-16 and stored as a byte. Similarly, DecodeOP_N presents a range of 0-16. Thus an unsigned char is a natural/direct representation for the value.
Removes the need for 2 casts in script/standard.cpp.
According to BIP 141, the version range is 0-16 and stored as a byte. Similarly, DecodeOP_N presents a range of 0-16. Thus an unsigned char is a natural/direct representation for the value.
Removes the need for 2 casts in script/standard.cpp.
According to BIP 141, the version range is 0-16 and stored as a byte.
Similarly, DecodeOP_N presents a range of 0-16. Thus an unsigned char
is a natural/direct representation for the value.
Removes the need for 2 casts.
Although internally it's stored as a byte, I wonder, are there other projects that might be relying on this API with "int" parameters instead of "unsigned char" parameters? If so, this could introduce an incompatibility (which should be avoidable by providing "int" parameterized subroutines alongside these "unsigned char" parameterized subroutines that are also marked as "deprecated" (and their documentation should note the correct subroutines to use).
What are your thoughts on this?
Good question, looking over the method signatures affected:
The following are static in script/interpreter.cpp, so not externally visible
VerifyWitnessProgramWitnessSigOpsDecodeOP_N is static in script/script.h. It could be moved to script/script.cpp if we also moved Solver to that file, from script/standard.cpp
CScript::IsWitnessProgram is necessarily publicly visible.
In both of the latter cases, we could overload the method in a deprecated way to enable ongoing support for any external callers. I'll take y'alls call as to whether that's necessary.
Sorry, but I don't see the point, to be honest. This is consensus critical code, if there's no good reason to change it (and "this type looks better" or "we can avoid a cast here" isn't a good reason like that) we shouldn't.
Closing for now, since there seems to be disagreement whether to do stylistic refactoring to consensus critical code.