1
0
mirror of https://github.com/bitcoin/bips.git synced 2025-05-12 12:03:29 +00:00

update OP_CAT implementation

This commit is contained in:
Armin Sabouri 2024-03-20 18:33:02 -04:00
parent 2b5ab3b1fd
commit b3493746b1
No known key found for this signature in database
GPG Key ID: A7571058A5A78A0A

View File

@ -43,16 +43,13 @@ OP_CAT pops two elements off the stack, concatenates them together in stack orde
===Implementation=== ===Implementation===
<pre> <pre>
case OP_CAT: case OP_CAT: {
{ if (stack.size() < 2)
if (stack.size() < 2) {
return set_error(serror, SCRIPT_ERR_INVALID_STACK_OPERATION); return set_error(serror, SCRIPT_ERR_INVALID_STACK_OPERATION);
}
valtype& vch1 = stacktop(-2); valtype& vch1 = stacktop(-2);
valtype& vch2 = stacktop(-1); valtype& vch2 = stacktop(-1);
if (vch1.size() + vch2.size() > MAX_SCRIPT_ELEMENT_SIZE) { if (vch1.size() + vch2.size() > MAX_SCRIPT_ELEMENT_SIZE)
return set_error(serror, SCRIPT_ERR_INVALID_STACK_OPERATION); return set_error(serror, SCRIPT_ERR_PUSH_SIZE);
}
vch1.insert(vch1.end(), vch2.begin(), vch2.end()); vch1.insert(vch1.end(), vch2.begin(), vch2.end());
stack.pop_back(); stack.pop_back();
} }