lib/bitcoin/opcodes.rb in bitcoinrb-0.1.7 vs lib/bitcoin/opcodes.rb in bitcoinrb-0.1.8

- old
+ new

@@ -114,12 +114,12 @@ OP_CHECKSIGVERIFY= 0xad OP_CHECKMULTISIG = 0xae OP_CHECKMULTISIGVERIFY = 0xaf # https://en.bitcoin.it/wiki/Script#Locktime - OP_NOP2 = OP_CHECKLOCKTIMEVERIFY = 0xb1 - OP_NOP3 = OP_CHECKSEQUENCEVERIFY = 0xb2 + OP_NOP2 = OP_CHECKLOCKTIMEVERIFY = OP_CLTV = 0xb1 + OP_NOP3 = OP_CHECKSEQUENCEVERIFY = OP_CSV = 0xb2 # https://en.bitcoin.it/wiki/Script#Reserved_words OP_RESERVED = 0x50 OP_VER = 0x62 OP_VERIF = 0x65 @@ -134,10 +134,16 @@ OP_NOP7 = 0xb6 OP_NOP8 = 0xb7 OP_NOP9 = 0xb8 OP_NOP10 = 0xb9 - OPCODES_MAP = Hash[*constants.grep(/^OP_/).map { |c| [const_get(c), c.to_s] }.flatten] + # https://en.bitcoin.it/wiki/Script#Pseudo-words + OP_PUBKEYHASH = 0xfd + OP_PUBKEY = 0xfe + OP_INVALIDOPCODE = 0xff + + DUPLICATE_KEY = [:OP_NOP2, :OP_NOP3] + OPCODES_MAP = Hash[*(constants.grep(/^OP_/) - [:OP_NOP2, :OP_NOP3, :OP_CHECKLOCKTIMEVERIFY, :OP_CHECKSEQUENCEVERIFY]).map { |c| [const_get(c), c.to_s] }.flatten] NAME_MAP = Hash[*constants.grep(/^OP_/).map { |c| [c.to_s, const_get(c)] }.flatten] def opcode_to_name(opcode) return OPCODES_MAP[opcode].delete('OP_') if opcode == OP_0 || (opcode <= OP_16 && opcode >= OP_1) OPCODES_MAP[opcode] \ No newline at end of file