mirror of
https://github.com/ElementsProject/elements.git
synced 2026-08-14 12:43:40 +02:00
Add a valid opcode sanity check to CScript
Added a function in CScript that checks if the script contains valid opcodes. Add a test for that function
This commit is contained in:
parent
9fec4da0be
commit
5b75c47784
3 changed files with 29 additions and 0 deletions
|
|
@ -267,3 +267,15 @@ std::string CScriptWitness::ToString() const
|
|||
}
|
||||
return ret + ")";
|
||||
}
|
||||
|
||||
bool CScript::HasValidOps() const
|
||||
{
|
||||
CScript::const_iterator it = begin();
|
||||
while (it < end()) {
|
||||
opcodetype opcode;
|
||||
if (!GetOp(it, opcode) || opcode > 0xb9) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue