You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

script_error.cpp 4.4KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. // Copyright (c) 2009-2010 Satoshi Nakamoto
  2. // Copyright (c) 2009-2016 The Starwels developers
  3. // Distributed under the MIT software license, see the accompanying
  4. // file COPYING or http://www.opensource.org/licenses/mit-license.php.
  5. #include "script_error.h"
  6. const char* ScriptErrorString(const ScriptError serror)
  7. {
  8. switch (serror)
  9. {
  10. case SCRIPT_ERR_OK:
  11. return "No error";
  12. case SCRIPT_ERR_EVAL_FALSE:
  13. return "Script evaluated without error but finished with a false/empty top stack element";
  14. case SCRIPT_ERR_VERIFY:
  15. return "Script failed an OP_VERIFY operation";
  16. case SCRIPT_ERR_EQUALVERIFY:
  17. return "Script failed an OP_EQUALVERIFY operation";
  18. case SCRIPT_ERR_CHECKMULTISIGVERIFY:
  19. return "Script failed an OP_CHECKMULTISIGVERIFY operation";
  20. case SCRIPT_ERR_CHECKSIGVERIFY:
  21. return "Script failed an OP_CHECKSIGVERIFY operation";
  22. case SCRIPT_ERR_NUMEQUALVERIFY:
  23. return "Script failed an OP_NUMEQUALVERIFY operation";
  24. case SCRIPT_ERR_SCRIPT_SIZE:
  25. return "Script is too big";
  26. case SCRIPT_ERR_PUSH_SIZE:
  27. return "Push value size limit exceeded";
  28. case SCRIPT_ERR_OP_COUNT:
  29. return "Operation limit exceeded";
  30. case SCRIPT_ERR_STACK_SIZE:
  31. return "Stack size limit exceeded";
  32. case SCRIPT_ERR_SIG_COUNT:
  33. return "Signature count negative or greater than pubkey count";
  34. case SCRIPT_ERR_PUBKEY_COUNT:
  35. return "Pubkey count negative or limit exceeded";
  36. case SCRIPT_ERR_BAD_OPCODE:
  37. return "Opcode missing or not understood";
  38. case SCRIPT_ERR_DISABLED_OPCODE:
  39. return "Attempted to use a disabled opcode";
  40. case SCRIPT_ERR_INVALID_STACK_OPERATION:
  41. return "Operation not valid with the current stack size";
  42. case SCRIPT_ERR_INVALID_ALTSTACK_OPERATION:
  43. return "Operation not valid with the current altstack size";
  44. case SCRIPT_ERR_OP_RETURN:
  45. return "OP_RETURN was encountered";
  46. case SCRIPT_ERR_UNBALANCED_CONDITIONAL:
  47. return "Invalid OP_IF construction";
  48. case SCRIPT_ERR_NEGATIVE_LOCKTIME:
  49. return "Negative locktime";
  50. case SCRIPT_ERR_UNSATISFIED_LOCKTIME:
  51. return "Locktime requirement not satisfied";
  52. case SCRIPT_ERR_SIG_HASHTYPE:
  53. return "Signature hash type missing or not understood";
  54. case SCRIPT_ERR_SIG_DER:
  55. return "Non-canonical DER signature";
  56. case SCRIPT_ERR_MINIMALDATA:
  57. return "Data push larger than necessary";
  58. case SCRIPT_ERR_SIG_PUSHONLY:
  59. return "Only non-push operators allowed in signatures";
  60. case SCRIPT_ERR_SIG_HIGH_S:
  61. return "Non-canonical signature: S value is unnecessarily high";
  62. case SCRIPT_ERR_SIG_NULLDUMMY:
  63. return "Dummy CHECKMULTISIG argument must be zero";
  64. case SCRIPT_ERR_MINIMALIF:
  65. return "OP_IF/NOTIF argument must be minimal";
  66. case SCRIPT_ERR_SIG_NULLFAIL:
  67. return "Signature must be zero for failed CHECK(MULTI)SIG operation";
  68. case SCRIPT_ERR_DISCOURAGE_UPGRADABLE_NOPS:
  69. return "NOPx reserved for soft-fork upgrades";
  70. case SCRIPT_ERR_DISCOURAGE_UPGRADABLE_WITNESS_PROGRAM:
  71. return "Witness version reserved for soft-fork upgrades";
  72. case SCRIPT_ERR_PUBKEYTYPE:
  73. return "Public key is neither compressed or uncompressed";
  74. case SCRIPT_ERR_WITNESS_PROGRAM_WRONG_LENGTH:
  75. return "Witness program has incorrect length";
  76. case SCRIPT_ERR_WITNESS_PROGRAM_WITNESS_EMPTY:
  77. return "Witness program was passed an empty witness";
  78. case SCRIPT_ERR_WITNESS_PROGRAM_MISMATCH:
  79. return "Witness program hash mismatch";
  80. case SCRIPT_ERR_WITNESS_MALLEATED:
  81. return "Witness requires empty scriptSig";
  82. case SCRIPT_ERR_WITNESS_MALLEATED_P2SH:
  83. return "Witness requires only-redeemscript scriptSig";
  84. case SCRIPT_ERR_WITNESS_UNEXPECTED:
  85. return "Witness provided for non-witness script";
  86. case SCRIPT_ERR_WITNESS_PUBKEYTYPE:
  87. return "Using non-compressed keys in segwit";
  88. case SCRIPT_ERR_UNKNOWN_ERROR:
  89. case SCRIPT_ERR_ERROR_COUNT:
  90. default: break;
  91. }
  92. return "unknown error";
  93. }