aboutsummaryrefslogtreecommitdiff
path: root/src/script/script.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/script/script.cpp')
-rw-r--r--src/script/script.cpp13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/script/script.cpp b/src/script/script.cpp
index 70eb8a139b..a10b619f7d 100644
--- a/src/script/script.cpp
+++ b/src/script/script.cpp
@@ -267,3 +267,16 @@ std::string CScriptWitness::ToString() const
}
return ret + ")";
}
+
+bool CScript::HasValidOps() const
+{
+ CScript::const_iterator it = begin();
+ while (it < end()) {
+ opcodetype opcode;
+ std::vector<unsigned char> item;
+ if (!GetOp(it, opcode, item) || opcode > MAX_OPCODE || item.size() > MAX_SCRIPT_ELEMENT_SIZE) {
+ return false;
+ }
+ }
+ return true;
+}