LCOV - code coverage report
Current view: top level - src/script - script_error.cpp (source / functions) Coverage Total Hit
Test: fuzz_coverage.info Lines: 100.0 % 110 110
Test Date: 2024-12-04 04:00:22 Functions: 100.0 % 1 1
Branches: 100.0 % 53 53

             Branch data     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                 :      169292 : std::string ScriptErrorString(const ScriptError serror)
      11                 :             : {
      12   [ +  +  +  +  :      169292 :     switch (serror)
          +  +  +  +  +  
          +  +  +  +  +  
          +  +  +  +  +  
          +  +  +  +  +  
          +  +  +  +  +  
          +  +  +  +  +  
          +  +  +  +  +  
          +  +  +  +  +  
          +  +  +  +  +  
             +  +  +  + ]
      13                 :             :     {
      14                 :         502 :         case SCRIPT_ERR_OK:
      15                 :         502 :             return "No error";
      16                 :        5823 :         case SCRIPT_ERR_EVAL_FALSE:
      17                 :        5823 :             return "Script evaluated without error but finished with a false/empty top stack element";
      18                 :         993 :         case SCRIPT_ERR_VERIFY:
      19                 :         993 :             return "Script failed an OP_VERIFY operation";
      20                 :         929 :         case SCRIPT_ERR_EQUALVERIFY:
      21                 :         929 :             return "Script failed an OP_EQUALVERIFY operation";
      22                 :          94 :         case SCRIPT_ERR_CHECKMULTISIGVERIFY:
      23                 :          94 :             return "Script failed an OP_CHECKMULTISIGVERIFY operation";
      24                 :         741 :         case SCRIPT_ERR_CHECKSIGVERIFY:
      25                 :         741 :             return "Script failed an OP_CHECKSIGVERIFY operation";
      26                 :         754 :         case SCRIPT_ERR_NUMEQUALVERIFY:
      27                 :         754 :             return "Script failed an OP_NUMEQUALVERIFY operation";
      28                 :         549 :         case SCRIPT_ERR_SCRIPT_SIZE:
      29                 :         549 :             return "Script is too big";
      30                 :        1060 :         case SCRIPT_ERR_PUSH_SIZE:
      31                 :        1060 :             return "Push value size limit exceeded";
      32                 :        2143 :         case SCRIPT_ERR_OP_COUNT:
      33                 :        2143 :             return "Operation limit exceeded";
      34                 :         667 :         case SCRIPT_ERR_STACK_SIZE:
      35                 :         667 :             return "Stack size limit exceeded";
      36                 :        1262 :         case SCRIPT_ERR_SIG_COUNT:
      37                 :        1262 :             return "Signature count negative or greater than pubkey count";
      38                 :        1423 :         case SCRIPT_ERR_PUBKEY_COUNT:
      39                 :        1423 :             return "Pubkey count negative or limit exceeded";
      40                 :       17077 :         case SCRIPT_ERR_BAD_OPCODE:
      41                 :       17077 :             return "Opcode missing or not understood";
      42                 :        8602 :         case SCRIPT_ERR_DISABLED_OPCODE:
      43                 :        8602 :             return "Attempted to use a disabled opcode";
      44                 :        3954 :         case SCRIPT_ERR_INVALID_STACK_OPERATION:
      45                 :        3954 :             return "Operation not valid with the current stack size";
      46                 :        1411 :         case SCRIPT_ERR_INVALID_ALTSTACK_OPERATION:
      47                 :        1411 :             return "Operation not valid with the current altstack size";
      48                 :        3235 :         case SCRIPT_ERR_OP_RETURN:
      49                 :        3235 :             return "OP_RETURN was encountered";
      50                 :        8164 :         case SCRIPT_ERR_UNBALANCED_CONDITIONAL:
      51                 :        8164 :             return "Invalid OP_IF construction";
      52                 :        1897 :         case SCRIPT_ERR_NEGATIVE_LOCKTIME:
      53                 :        1897 :             return "Negative locktime";
      54                 :        6055 :         case SCRIPT_ERR_UNSATISFIED_LOCKTIME:
      55                 :        6055 :             return "Locktime requirement not satisfied";
      56                 :        5244 :         case SCRIPT_ERR_SIG_HASHTYPE:
      57                 :        5244 :             return "Signature hash type missing or not understood";
      58                 :        3432 :         case SCRIPT_ERR_SIG_DER:
      59                 :        3432 :             return "Non-canonical DER signature";
      60                 :        1799 :         case SCRIPT_ERR_MINIMALDATA:
      61                 :        1799 :             return "Data push larger than necessary";
      62                 :          23 :         case SCRIPT_ERR_SIG_PUSHONLY:
      63                 :          23 :             return "Only push operators allowed in signatures";
      64                 :           4 :         case SCRIPT_ERR_SIG_HIGH_S:
      65                 :           4 :             return "Non-canonical signature: S value is unnecessarily high";
      66                 :         896 :         case SCRIPT_ERR_SIG_NULLDUMMY:
      67                 :         896 :             return "Dummy CHECKMULTISIG argument must be zero";
      68                 :           3 :         case SCRIPT_ERR_MINIMALIF:
      69                 :           3 :             return "OP_IF/NOTIF argument must be minimal";
      70                 :           8 :         case SCRIPT_ERR_SIG_NULLFAIL:
      71                 :           8 :             return "Signature must be zero for failed CHECK(MULTI)SIG operation";
      72                 :        1407 :         case SCRIPT_ERR_DISCOURAGE_UPGRADABLE_NOPS:
      73                 :        1407 :             return "NOPx reserved for soft-fork upgrades";
      74                 :        1800 :         case SCRIPT_ERR_DISCOURAGE_UPGRADABLE_WITNESS_PROGRAM:
      75                 :        1800 :             return "Witness version reserved for soft-fork upgrades";
      76                 :           3 :         case SCRIPT_ERR_DISCOURAGE_UPGRADABLE_TAPROOT_VERSION:
      77                 :           3 :             return "Taproot version reserved for soft-fork upgrades";
      78                 :           7 :         case SCRIPT_ERR_DISCOURAGE_OP_SUCCESS:
      79                 :           7 :             return "OP_SUCCESSx reserved for soft-fork upgrades";
      80                 :           5 :         case SCRIPT_ERR_DISCOURAGE_UPGRADABLE_PUBKEYTYPE:
      81                 :           5 :             return "Public key version reserved for soft-fork upgrades";
      82                 :        2798 :         case SCRIPT_ERR_PUBKEYTYPE:
      83                 :        2798 :             return "Public key is neither compressed or uncompressed";
      84                 :        2672 :         case SCRIPT_ERR_CLEANSTACK:
      85                 :        2672 :             return "Stack size must be exactly one after execution";
      86                 :        1331 :         case SCRIPT_ERR_WITNESS_PROGRAM_WRONG_LENGTH:
      87                 :        1331 :             return "Witness program has incorrect length";
      88                 :       57199 :         case SCRIPT_ERR_WITNESS_PROGRAM_WITNESS_EMPTY:
      89                 :       57199 :             return "Witness program was passed an empty witness";
      90                 :        5434 :         case SCRIPT_ERR_WITNESS_PROGRAM_MISMATCH:
      91                 :        5434 :             return "Witness program hash mismatch";
      92                 :        5159 :         case SCRIPT_ERR_WITNESS_MALLEATED:
      93                 :        5159 :             return "Witness requires empty scriptSig";
      94                 :           6 :         case SCRIPT_ERR_WITNESS_MALLEATED_P2SH:
      95                 :           6 :             return "Witness requires only-redeemscript scriptSig";
      96                 :         306 :         case SCRIPT_ERR_WITNESS_UNEXPECTED:
      97                 :         306 :             return "Witness provided for non-witness script";
      98                 :           3 :         case SCRIPT_ERR_WITNESS_PUBKEYTYPE:
      99                 :           3 :             return "Using non-compressed keys in segwit";
     100                 :         780 :         case SCRIPT_ERR_SCHNORR_SIG_SIZE:
     101                 :         780 :             return "Invalid Schnorr signature size";
     102                 :          63 :         case SCRIPT_ERR_SCHNORR_SIG_HASHTYPE:
     103                 :          63 :             return "Invalid Schnorr signature hash type";
     104                 :         118 :         case SCRIPT_ERR_SCHNORR_SIG:
     105                 :         118 :             return "Invalid Schnorr signature";
     106                 :         726 :         case SCRIPT_ERR_TAPROOT_WRONG_CONTROL_SIZE:
     107                 :         726 :             return "Invalid Taproot control block size";
     108                 :           8 :         case SCRIPT_ERR_TAPSCRIPT_VALIDATION_WEIGHT:
     109                 :           8 :             return "Too much signature validation relative to witness weight";
     110                 :          16 :         case SCRIPT_ERR_TAPSCRIPT_CHECKMULTISIG:
     111                 :          16 :             return "OP_CHECKMULTISIG(VERIFY) is not available in tapscript";
     112                 :           5 :         case SCRIPT_ERR_TAPSCRIPT_MINIMALIF:
     113                 :           5 :             return "OP_IF/NOTIF argument must be minimal in tapscript";
     114                 :         922 :         case SCRIPT_ERR_OP_CODESEPARATOR:
     115                 :         922 :             return "Using OP_CODESEPARATOR in non-witness script";
     116                 :        3427 :         case SCRIPT_ERR_SIG_FINDANDDELETE:
     117                 :        3427 :             return "Signature is found in scriptCode";
     118                 :        6353 :         case SCRIPT_ERR_UNKNOWN_ERROR:
     119                 :        6353 :         case SCRIPT_ERR_ERROR_COUNT:
     120                 :        6353 :         default: break;
     121                 :             :     }
     122                 :        6353 :     return "unknown error";
     123                 :             : }
        

Generated by: LCOV version 2.0-1