Class: BTC::ScriptError
- Inherits:
-
Object
- Object
- BTC::ScriptError
- Includes:
- ScriptErrors
- Defined in:
- lib/btcruby/script/script_error.rb
Constant Summary
Constants included from ScriptErrors
BTC::ScriptErrors::SCRIPT_ERR_BAD_OPCODE, BTC::ScriptErrors::SCRIPT_ERR_CHECKMULTISIGVERIFY, BTC::ScriptErrors::SCRIPT_ERR_CHECKSIGVERIFY, BTC::ScriptErrors::SCRIPT_ERR_CLEANSTACK, BTC::ScriptErrors::SCRIPT_ERR_DISABLED_OPCODE, BTC::ScriptErrors::SCRIPT_ERR_DISCOURAGE_UPGRADABLE_NOPS, BTC::ScriptErrors::SCRIPT_ERR_EQUALVERIFY, BTC::ScriptErrors::SCRIPT_ERR_EVAL_FALSE, BTC::ScriptErrors::SCRIPT_ERR_INVALID_ALTSTACK_OPERATION, BTC::ScriptErrors::SCRIPT_ERR_INVALID_STACK_OPERATION, BTC::ScriptErrors::SCRIPT_ERR_MINIMALDATA, BTC::ScriptErrors::SCRIPT_ERR_NEGATIVE_LOCKTIME, BTC::ScriptErrors::SCRIPT_ERR_NUMEQUALVERIFY, BTC::ScriptErrors::SCRIPT_ERR_OK, BTC::ScriptErrors::SCRIPT_ERR_OP_COUNT, BTC::ScriptErrors::SCRIPT_ERR_OP_RETURN, BTC::ScriptErrors::SCRIPT_ERR_PUBKEYTYPE, BTC::ScriptErrors::SCRIPT_ERR_PUBKEY_COUNT, BTC::ScriptErrors::SCRIPT_ERR_PUSH_SIZE, BTC::ScriptErrors::SCRIPT_ERR_SCRIPT_SIZE, BTC::ScriptErrors::SCRIPT_ERR_SIG_COUNT, BTC::ScriptErrors::SCRIPT_ERR_SIG_DER, BTC::ScriptErrors::SCRIPT_ERR_SIG_HASHTYPE, BTC::ScriptErrors::SCRIPT_ERR_SIG_HIGH_S, BTC::ScriptErrors::SCRIPT_ERR_SIG_NULLDUMMY, BTC::ScriptErrors::SCRIPT_ERR_SIG_PUSHONLY, BTC::ScriptErrors::SCRIPT_ERR_STACK_SIZE, BTC::ScriptErrors::SCRIPT_ERR_UNBALANCED_CONDITIONAL, BTC::ScriptErrors::SCRIPT_ERR_UNKNOWN_ERROR, BTC::ScriptErrors::SCRIPT_ERR_UNSATISFIED_LOCKTIME, BTC::ScriptErrors::SCRIPT_ERR_VERIFY
Instance Attribute Summary collapse
-
#code ⇒ Object
readonly
Returns the value of attribute code.
-
#description ⇒ Object
readonly
Returns the value of attribute description.
-
#message ⇒ Object
readonly
Returns the value of attribute message.
Instance Method Summary collapse
- #builtin_description ⇒ Object
- #code_name ⇒ Object
-
#initialize(code, message = nil) ⇒ ScriptError
constructor
A new instance of ScriptError.
- #inspect ⇒ Object
Constructor Details
#initialize(code, message = nil) ⇒ ScriptError
Returns a new instance of ScriptError.
56 57 58 59 |
# File 'lib/btcruby/script/script_error.rb', line 56 def initialize(code, = nil) @code = code @message = end |
Instance Attribute Details
#code ⇒ Object (readonly)
Returns the value of attribute code.
52 53 54 |
# File 'lib/btcruby/script/script_error.rb', line 52 def code @code end |
#description ⇒ Object (readonly)
Returns the value of attribute description.
54 55 56 |
# File 'lib/btcruby/script/script_error.rb', line 54 def description @description end |
#message ⇒ Object (readonly)
Returns the value of attribute message.
53 54 55 |
# File 'lib/btcruby/script/script_error.rb', line 53 def @message end |
Instance Method Details
#builtin_description ⇒ Object
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 127 128 129 130 131 132 133 134 135 136 |
# File 'lib/btcruby/script/script_error.rb', line 73 def builtin_description case @code when SCRIPT_ERR_OK return "No error" when SCRIPT_ERR_EVAL_FALSE return "Script evaluated without error but finished with a false/empty top stack element" when SCRIPT_ERR_VERIFY return "Script failed an OP_VERIFY operation" when SCRIPT_ERR_EQUALVERIFY return "Script failed an OP_EQUALVERIFY operation" when SCRIPT_ERR_CHECKMULTISIGVERIFY return "Script failed an OP_CHECKMULTISIGVERIFY operation" when SCRIPT_ERR_CHECKSIGVERIFY return "Script failed an OP_CHECKSIGVERIFY operation" when SCRIPT_ERR_NUMEQUALVERIFY return "Script failed an OP_NUMEQUALVERIFY operation" when SCRIPT_ERR_SCRIPT_SIZE return "Script is too big" when SCRIPT_ERR_PUSH_SIZE return "Push value size limit exceeded" when SCRIPT_ERR_OP_COUNT return "Operation limit exceeded" when SCRIPT_ERR_STACK_SIZE return "Stack size limit exceeded" when SCRIPT_ERR_SIG_COUNT return "Signature count negative or greater than pubkey count" when SCRIPT_ERR_PUBKEY_COUNT return "Pubkey count negative or limit exceeded" when SCRIPT_ERR_BAD_OPCODE return "Opcode missing or not understood" when SCRIPT_ERR_DISABLED_OPCODE return "Attempted to use a disabled opcode" when SCRIPT_ERR_INVALID_STACK_OPERATION return "Operation not valid with the current stack size" when SCRIPT_ERR_INVALID_ALTSTACK_OPERATION return "Operation not valid with the current altstack size" when SCRIPT_ERR_OP_RETURN return "OP_RETURN was encountered" when SCRIPT_ERR_UNBALANCED_CONDITIONAL return "Invalid OP_IF construction" when SCRIPT_ERR_NEGATIVE_LOCKTIME return "Negative locktime" when SCRIPT_ERR_UNSATISFIED_LOCKTIME return "Locktime requirement not satisfied" when SCRIPT_ERR_SIG_HASHTYPE return "Signature hash type missing or not understood" when SCRIPT_ERR_SIG_DER return "Non-canonical DER signature" when SCRIPT_ERR_MINIMALDATA return "Data push larger than necessary" when SCRIPT_ERR_SIG_PUSHONLY return "Only non-push operators allowed in signatures" when SCRIPT_ERR_SIG_HIGH_S return "Non-canonical signature: S value is unnecessarily high" when SCRIPT_ERR_SIG_NULLDUMMY return "Dummy CHECKMULTISIG argument must be zero" when SCRIPT_ERR_DISCOURAGE_UPGRADABLE_NOPS return "NOPx reserved for soft-fork upgrades" when SCRIPT_ERR_PUBKEYTYPE return "Public key is neither compressed or uncompressed" when SCRIPT_ERR_UNKNOWN_ERROR end "unknown error" end |
#code_name ⇒ Object
61 62 63 |
# File 'lib/btcruby/script/script_error.rb', line 61 def code_name self.class.constants.find{|n| self.class.const_get(n) == @code } end |
#inspect ⇒ Object
65 66 67 |
# File 'lib/btcruby/script/script_error.rb', line 65 def inspect "#<#{self.class}:#{code} #{description} (#{code_name})>" end |