1
0
Fork 0
mirror of https://github.com/bitcoin/bips.git synced 2025-03-04 11:08:05 +01:00

Merge pull request #3 from 0xBEEFCAF3/cat

Update OP_CAT implementation code
This commit is contained in:
Ethan Heilman 2024-03-20 23:39:53 -04:00 committed by GitHub
commit 35641a87d7
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

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