Exception: Bitcoin::ScriptError
- Inherits:
-
Exception
- Object
- Exception
- Bitcoin::ScriptError
- Defined in:
- lib/bitcoin/script/script_error.rb
Overview
bitcoin script error
Instance Attribute Summary collapse
-
#code ⇒ Object
Returns the value of attribute code.
-
#extra_msg ⇒ Object
Returns the value of attribute extra_msg.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(code, extra_msg = '') ⇒ ScriptError
constructor
A new instance of ScriptError.
- #ok? ⇒ Boolean
- #to_s ⇒ Object
Constructor Details
#initialize(code, extra_msg = '') ⇒ ScriptError
Returns a new instance of ScriptError.
9 10 11 12 13 |
# File 'lib/bitcoin/script/script_error.rb', line 9 def initialize(code, extra_msg = '') raise 'invalid error code.' unless ERRCODES_MAP[code] @code = code @extra_msg = extra_msg end |
Instance Attribute Details
#code ⇒ Object
Returns the value of attribute code.
6 7 8 |
# File 'lib/bitcoin/script/script_error.rb', line 6 def code @code end |
#extra_msg ⇒ Object
Returns the value of attribute extra_msg.
7 8 9 |
# File 'lib/bitcoin/script/script_error.rb', line 7 def extra_msg @extra_msg end |
Class Method Details
.name_to_code(name) ⇒ Object
132 133 134 |
# File 'lib/bitcoin/script/script_error.rb', line 132 def self.name_to_code(name) NAME_MAP[name] end |
Instance Method Details
#ok? ⇒ Boolean
128 129 130 |
# File 'lib/bitcoin/script/script_error.rb', line 128 def ok? code == Bitcoin::SCRIPT_ERR_OK end |
#to_s ⇒ Object
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 |
# File 'lib/bitcoin/script/script_error.rb', line 15 def to_s case code when SCRIPT_ERR_OK 'No error' when SCRIPT_ERR_EVAL_FALSE 'Script evaluated without error but finished with a false/empty top stack element' when SCRIPT_ERR_VERIFY 'Script failed an OP_VERIFY operation' when SCRIPT_ERR_EQUALVERIFY 'Script failed an OP_EQUALVERIFY operation' when SCRIPT_ERR_CHECKMULTISIGVERIFY 'Script failed an OP_CHECKMULTISIGVERIFY operation' when SCRIPT_ERR_CHECKSIGVERIFY 'Script failed an OP_CHECKSIGVERIFY operation' when SCRIPT_ERR_NUMEQUALVERIFY 'Script failed an OP_NUMEQUALVERIFY operation' when SCRIPT_ERR_SCRIPT_SIZE 'Script is too big' when SCRIPT_ERR_PUSH_SIZE 'Push value size limit exceeded' when SCRIPT_ERR_OP_COUNT 'Operation limit exceeded' when SCRIPT_ERR_STACK_SIZE 'Stack size limit exceeded' when SCRIPT_ERR_SIG_COUNT 'Signature count negative or greater than pubkey count' when SCRIPT_ERR_PUBKEY_COUNT 'Pubkey count negative or limit exceeded' when SCRIPT_ERR_BAD_OPCODE 'Opcode missing or not understood' when SCRIPT_ERR_DISABLED_OPCODE 'Attempted to use a disabled opcode' when SCRIPT_ERR_INVALID_STACK_OPERATION 'Operation not valid with the current stack size' when SCRIPT_ERR_INVALID_ALTSTACK_OPERATION 'Operation not valid with the current altstack size' when SCRIPT_ERR_OP_RETURN 'OP_was encountered' when SCRIPT_ERR_UNBALANCED_CONDITIONAL 'Invalid OP_IF construction' when SCRIPT_ERR_NEGATIVE_LOCKTIME 'Negative locktime' when SCRIPT_ERR_UNSATISFIED_LOCKTIME 'Locktime requirement not satisfied' when SCRIPT_ERR_SIG_HASHTYPE 'Signature hash type missing or not understood' when SCRIPT_ERR_SIG_DER 'Non-canonical DER signature' when SCRIPT_ERR_MINIMALDATA 'Data push larger than necessary' when SCRIPT_ERR_SIG_PUSHONLY 'Only non-push operators allowed in signatures' when SCRIPT_ERR_SIG_HIGH_S 'Non-canonical signature S value is unnecessarily high' when SCRIPT_ERR_SIG_NULLDUMMY 'Dummy CHECKMULTISIG argument must be zero' when SCRIPT_ERR_MINIMALIF 'OP_IF/NOTIF argument must be minimal' when SCRIPT_ERR_SIG_NULLFAIL 'Signature must be zero for failed CHECK(MULTI)SIG operation' when SCRIPT_ERR_DISCOURAGE_UPGRADABLE_NOPS 'NOPx reserved for soft-fork upgrades' when SCRIPT_ERR_DISCOURAGE_UPGRADABLE_WITNESS_PROGRAM 'Witness version reserved for soft-fork upgrades' when SCRIPT_ERR_DISCOURAGE_UPGRADABLE_TAPROOT_VERSION 'Taproot version reserved for soft-fork upgrades' when SCRIPT_ERR_DISCOURAGE_UNKNOWN_ANNEX 'Unknown input annex reserved for soft-fork upgrades' when SCRIPT_ERR_DISCOURAGE_OP_SUCCESS 'SUCCESSx reserved for soft-fork upgrades' when SCRIPT_ERR_DISCOURAGE_UPGRADABLE_PUBKEYTYPE 'Public key version reserved for soft-fork upgrades' when SCRIPT_ERR_PUBKEYTYPE 'Public key is neither compressed or uncompressed' when SCRIPT_ERR_WITNESS_PROGRAM_WRONG_LENGTH 'Witness program has incorrect length' when SCRIPT_ERR_WITNESS_PROGRAM_WITNESS_EMPTY 'Witness program was passed an empty witness' when SCRIPT_ERR_WITNESS_PROGRAM_MISMATCH 'Witness program hash mismatch' when SCRIPT_ERR_WITNESS_MALLEATED 'Witness requires empty scriptSig' when SCRIPT_ERR_WITNESS_MALLEATED_P2SH 'Witness requires only-redeemscript scriptSig' when SCRIPT_ERR_WITNESS_UNEXPECTED 'Witness provided for non-witness script' when SCRIPT_ERR_WITNESS_PUBKEYTYPE 'Using non-compressed keys in segwit' when SCRIPT_ERR_SCHNORR_SIG_SIZE 'Invalid Schnorr signature size' when SCRIPT_ERR_SCHNORR_SIG_HASHTYPE 'Invalid Schnorr signature hash type' when SCRIPT_ERR_SCHNORR_SIG 'Invalid Schnorr signature' when SCRIPT_ERR_TAPROOT_WRONG_CONTROL_SIZE 'Invalid Taproot control block size' when SCRIPT_ERR_TAPSCRIPT_VALIDATION_WEIGHT 'Too much signature validation relative to witness weight' when SCRIPT_ERR_TAPSCRIPT_CHECKMULTISIG 'OP_CHECKMULTISIG(VERIFY) is not available in tapscript' when SCRIPT_ERR_TAPSCRIPT_MINIMALIF 'OP_IF/NOTIF argument must be minimal in tapscript' when SCRIPT_ERR_OP_CODESEPARATOR 'Using OP_CODESEPARATOR in non-witness script' when SCRIPT_ERR_SIG_FINDANDDELETE 'Signature is found in scriptCode' when SCRIPT_ERR_UNKNOWN_ERROR, SCRIPT_ERR_ERROR_COUNT 'unknown error' else extra_msg ? extra_msg : 'unknown error' end end |