BitcoinNetwork / src /opcode.rs
LordXido's picture
Update src/opcode.rs
2e868ad verified
#[derive(Debug, Clone, Copy, PartialEq)]
pub enum Opcode {
INVCHK = 0x20,
TADD = 0x30,
TSUB = 0x31,
FADD = 0x40,
FVEL = 0x41,
CISS = 0x50,
CRET = 0x51,
CCAP = 0x52,
CDEF = 0x54,
CREW = 0x55,
IBND = 0x60,
IPRF = 0x61,
ILOCK = 0x63,
LBL = 0x72,
VCAST = 0x80,
VWEI = 0x81,
SIM = 0x90,
HALT = 0xA0,
NOOP = 0xA1,
}
impl Opcode {
pub fn from_byte(b: u8) -> Option<Self> {
use Opcode::*;
Some(match b {
0x20 => INVCHK,
0x30 => TADD,
0x31 => TSUB,
0x40 => FADD,
0x41 => FVEL,
0x50 => CISS,
0x51 => CRET,
0x52 => CCAP,
0x54 => CDEF,
0x55 => CREW,
0x60 => IBND,
0x61 => IPRF,
0x63 => ILOCK,
0x72 => LBL,
0x80 => VCAST,
0x81 => VWEI,
0x90 => SIM,
0xA0 => HALT,
0xA1 => NOOP,
_ => return None,
})
}
}