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:
commit
35641a87d7
1 changed files with 9 additions and 12 deletions
|
@ -43,18 +43,15 @@ 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& vch2 = stacktop(-1);
|
||||||
valtype& vch1 = stacktop(-2);
|
if (vch1.size() + vch2.size() > MAX_SCRIPT_ELEMENT_SIZE)
|
||||||
valtype& vch2 = stacktop(-1);
|
return set_error(serror, SCRIPT_ERR_PUSH_SIZE);
|
||||||
if (vch1.size() + vch2.size() > MAX_SCRIPT_ELEMENT_SIZE) {
|
vch1.insert(vch1.end(), vch2.begin(), vch2.end());
|
||||||
return set_error(serror, SCRIPT_ERR_INVALID_STACK_OPERATION);
|
stack.pop_back();
|
||||||
}
|
|
||||||
vch1.insert(vch1.end(), vch2.begin(), vch2.end());
|
|
||||||
stack.pop_back();
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
</pre>
|
</pre>
|
||||||
|
|
Loading…
Add table
Reference in a new issue