Check that all of the input and output scripts of a transaction contain valid opcodes
| 132 | |
| 133 | /// Check that all of the input and output scripts of a transaction contain valid opcodes |
| 134 | static bool CheckTxScriptsSanity(const CMutableTransaction& tx) |
| 135 | { |
| 136 | // Check input scripts for non-coinbase txs |
| 137 | if (!CTransaction(tx).IsCoinBase()) { |
| 138 | for (unsigned int i = 0; i < tx.vin.size(); i++) { |
| 139 | if (!tx.vin[i].scriptSig.HasValidOps() || tx.vin[i].scriptSig.size() > MAX_SCRIPT_SIZE) { |
| 140 | return false; |
| 141 | } |
| 142 | } |
| 143 | } |
| 144 | // Check output scripts |
| 145 | for (unsigned int i = 0; i < tx.vout.size(); i++) { |
| 146 | if (!tx.vout[i].scriptPubKey.HasValidOps() || tx.vout[i].scriptPubKey.size() > MAX_SCRIPT_SIZE) { |
| 147 | return false; |
| 148 | } |
| 149 | } |
| 150 | |
| 151 | return true; |
| 152 | } |
| 153 | |
| 154 | static bool DecodeTx(CMutableTransaction& tx, const std::vector<unsigned char>& tx_data, bool try_no_witness, bool try_witness) |
| 155 | { |
no test coverage detected