pub struct All { /* private fields */ }
Expand description
A script Opcode.
We do not implement Ord on this type because there is no natural ordering on opcodes, but there
may appear to be one (e.g. because all the push opcodes appear in a consecutive block) and we
don’t want to encourage subtly buggy code. Please use All::classify
to distinguish different
types of opcodes.
Example of Core bug caused by assuming ordering
Bitcoin Core’s IsPushOnly
considers OP_RESERVED
to be a “push code”, allowing this opcode
in contexts where only pushes are supposed to be allowed.
Implementations§
Trait Implementations§
source§impl From<WitnessVersion> for All
impl From<WitnessVersion> for All
source§fn from(version: WitnessVersion) -> All
fn from(version: WitnessVersion) -> All
Converts WitnessVersion
instance into corresponding Bitcoin scriptopcode (OP_0
..OP_16
).
source§impl TryFrom<All> for WitnessVersion
impl TryFrom<All> for WitnessVersion
source§fn try_from(opcode: All) -> Result<Self, Self::Error>
fn try_from(opcode: All) -> Result<Self, Self::Error>
Converts bitcoin script opcode into WitnessVersion
variant.
Returns
Version of the Witness program (for opcodes in range of OP_0
..OP_16
).
Errors
If the opcode does not correspond to any witness version, errors with
Error::MalformedWitnessVersion
.