Check that all of the input and output scripts of a transaction contains valid opcodes
| 106 | |
| 107 | // Check that all of the input and output scripts of a transaction contains valid opcodes |
| 108 | static bool CheckTxScriptsSanity(const CMutableTransaction& tx) |
| 109 | { |
| 110 | // Check input scripts for non-coinbase txs |
| 111 | if (!CTransaction(tx).IsCoinBase()) { |
| 112 | for (unsigned int i = 0; i < tx.vin.size(); i++) { |
| 113 | if (!tx.vin[i].scriptSig.HasValidOps() || tx.vin[i].scriptSig.size() > MAX_SCRIPT_SIZE) { |
| 114 | return false; |
| 115 | } |
| 116 | } |
| 117 | } |
| 118 | // Check output scripts |
| 119 | for (unsigned int i = 0; i < tx.vout.size(); i++) { |
| 120 | if (!tx.vout[i].scriptPubKey.HasValidOps() || tx.vout[i].scriptPubKey.size() > MAX_SCRIPT_SIZE) { |
| 121 | return false; |
| 122 | } |
| 123 | } |
| 124 | |
| 125 | return true; |
| 126 | } |
| 127 | |
| 128 | static bool DecodeTx(CMutableTransaction& tx, const std::vector<unsigned char>& tx_data, bool try_no_witness, bool try_witness) |
| 129 | { |
no test coverage detected