1
0
mirror of https://github.com/bitcoin/bips.git synced 2026-05-11 16:51:51 +00: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

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();
} }