Check that all of the input and output scripts of a transaction contains valid opcodes
| 91 | |
| 92 | // Check that all of the input and output scripts of a transaction contains valid opcodes |
| 93 | static bool CheckTxScriptsSanity(const CMutableTransaction& tx) |
| 94 | { |
| 95 | // Check input scripts for non-coinbase txs |
| 96 | if (!CTransaction(tx).IsCoinBase()) { |
| 97 | for (unsigned int i = 0; i < tx.vin.size(); i++) { |
| 98 | if (!tx.vin[i].scriptSig.HasValidOps() || tx.vin[i].scriptSig.size() > MAX_SCRIPT_SIZE) { |
| 99 | return false; |
| 100 | } |
| 101 | } |
| 102 | } |
| 103 | // Check output scripts |
| 104 | for (unsigned int i = 0; i < tx.vout.size(); i++) { |
| 105 | if (!tx.vout[i].scriptPubKey.HasValidOps() || tx.vout[i].scriptPubKey.size() > MAX_SCRIPT_SIZE) { |
| 106 | return false; |
| 107 | } |
| 108 | } |
| 109 | |
| 110 | return true; |
| 111 | } |
| 112 | |
| 113 | bool DecodeHexTx(CMutableTransaction& tx, const std::string& hex_tx, bool try_no_witness, bool try_witness) |
| 114 | { |
no test coverage detected