MCPcopy Create free account
hub / github.com/BTCGPU/BTCGPU / CheckTxScriptsSanity

Function CheckTxScriptsSanity

src/core_read.cpp:93–111  ·  view source on GitHub ↗

Check that all of the input and output scripts of a transaction contains valid opcodes

Source from the content-addressed store, hash-verified

91
92// Check that all of the input and output scripts of a transaction contains valid opcodes
93static 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
113bool DecodeHexTx(CMutableTransaction& tx, const std::string& hex_tx, bool try_no_witness, bool try_witness)
114{

Callers 1

DecodeHexTxFunction · 0.85

Calls 4

HasValidOpsMethod · 0.80
CTransactionClass · 0.70
IsCoinBaseMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected