Line data Source code
1 : // Copyright (c) 2009-2010 Satoshi Nakamoto 2 : // Copyright (c) 2009-2020 The Bitcoin Core developers 3 : // Distributed under the MIT software license, see the accompanying 4 : // file COPYING or http://www.opensource.org/licenses/mit-license.php. 5 : 6 : #include <script/script_error.h> 7 : 8 : #include <string> 9 : 10 98247 : std::string ScriptErrorString(const ScriptError serror) 11 : { 12 98247 : switch (serror) 13 : { 14 : case SCRIPT_ERR_OK: 15 69995 : return "No error"; 16 : case SCRIPT_ERR_EVAL_FALSE: 17 74 : return "Script evaluated without error but finished with a false/empty top stack element"; 18 : case SCRIPT_ERR_VERIFY: 19 18 : return "Script failed an OP_VERIFY operation"; 20 : case SCRIPT_ERR_EQUALVERIFY: 21 1 : return "Script failed an OP_EQUALVERIFY operation"; 22 : case SCRIPT_ERR_CHECKMULTISIGVERIFY: 23 0 : return "Script failed an OP_CHECKMULTISIGVERIFY operation"; 24 : case SCRIPT_ERR_CHECKSIGVERIFY: 25 120 : return "Script failed an OP_CHECKSIGVERIFY operation"; 26 : case SCRIPT_ERR_CHECKDATASIGVERIFY: 27 0 : return "Script failed an OP_CHECKDATASIGVERIFY operation"; 28 : case SCRIPT_ERR_NUMEQUALVERIFY: 29 0 : return "Script failed an OP_NUMEQUALVERIFY operation"; 30 : case SCRIPT_ERR_SCRIPT_SIZE: 31 0 : return "Script is too big"; 32 : case SCRIPT_ERR_PUSH_SIZE: 33 0 : return "Push value size limit exceeded"; 34 : case SCRIPT_ERR_OP_COUNT: 35 0 : return "Operation limit exceeded"; 36 : case SCRIPT_ERR_STACK_SIZE: 37 0 : return "Stack size limit exceeded"; 38 : case SCRIPT_ERR_SIG_COUNT: 39 0 : return "Signature count negative or greater than pubkey count"; 40 : case SCRIPT_ERR_PUBKEY_COUNT: 41 0 : return "Pubkey count negative or limit exceeded"; 42 : case SCRIPT_ERR_BAD_OPCODE: 43 1 : return "Opcode missing or not understood"; 44 : case SCRIPT_ERR_DISABLED_OPCODE: 45 0 : return "Attempted to use a disabled opcode"; 46 : case SCRIPT_ERR_INVALID_STACK_OPERATION: 47 7698 : return "Operation not valid with the current stack size"; 48 : case SCRIPT_ERR_INVALID_ALTSTACK_OPERATION: 49 0 : return "Operation not valid with the current altstack size"; 50 : case SCRIPT_ERR_OP_RETURN: 51 0 : return "OP_RETURN was encountered"; 52 : case SCRIPT_ERR_UNBALANCED_CONDITIONAL: 53 31 : return "Invalid OP_IF construction"; 54 : case SCRIPT_ERR_INVALID_SPLIT_RANGE: 55 0 : return "Invalid OP_SPLIT range"; 56 : case SCRIPT_ERR_INVALID_OPERAND_SIZE: 57 0 : return "Invalid operand size"; 58 : case SCRIPT_ERR_INVALID_NUMBER_RANGE: 59 0 : return "Given operand is not a number within the valid range " 60 : "[-2^31...2^31]"; 61 : case SCRIPT_ERR_IMPOSSIBLE_ENCODING: 62 0 : return "The requested encoding is impossible to satisfy"; 63 : case SCRIPT_ERR_DIV_BY_ZERO: 64 0 : return "Division by zero error"; 65 : case SCRIPT_ERR_MOD_BY_ZERO: 66 0 : return "Modulo by zero error"; 67 : case SCRIPT_ERR_NEGATIVE_LOCKTIME: 68 133 : return "Negative locktime"; 69 : case SCRIPT_ERR_UNSATISFIED_LOCKTIME: 70 10816 : return "Locktime requirement not satisfied"; 71 : case SCRIPT_ERR_SIG_HASHTYPE: 72 0 : return "Signature hash type missing or not understood"; 73 : case SCRIPT_ERR_SIG_DER: 74 8871 : return "Non-canonical DER signature"; 75 : case SCRIPT_ERR_MINIMALDATA: 76 8 : return "Data push larger than necessary"; 77 : case SCRIPT_ERR_SIG_PUSHONLY: 78 70 : return "Only push operators allowed in signatures"; 79 : case SCRIPT_ERR_SIG_HIGH_S: 80 30 : return "Non-canonical signature: S value is unnecessarily high"; 81 : case SCRIPT_ERR_SIG_NULLDUMMY: 82 40 : return "Dummy CHECKMULTISIG argument must be zero"; 83 : case SCRIPT_ERR_SIG_NULLFAIL: 84 0 : return "Signature must be zero for failed CHECK(MULTI)SIG operation"; 85 : case SCRIPT_ERR_DISCOURAGE_UPGRADABLE_NOPS: 86 0 : return "NOPx reserved for soft-fork upgrades"; 87 : case SCRIPT_ERR_PUBKEYTYPE: 88 0 : return "Public key is neither compressed or uncompressed"; 89 : case SCRIPT_ERR_CLEANSTACK: 90 0 : return "Stack size must be exactly one after execution"; 91 : case SCRIPT_ERR_OP_CODESEPARATOR: 92 175 : return "Using OP_CODESEPARATOR"; 93 : case SCRIPT_ERR_SIG_FINDANDDELETE: 94 112 : return "Signature is found in scriptCode"; 95 : case SCRIPT_ERR_UNKNOWN_ERROR: 96 54 : case SCRIPT_ERR_ERROR_COUNT: 97 54 : default: break; 98 : } 99 54 : return "unknown error"; 100 98247 : }