Skip to content

Commit 35641a8

Browse files
authored
Merge pull request bitcoin#3 from 0xBEEFCAF3/cat
Update OP_CAT implementation code
2 parents 2b5ab3b + b349374 commit 35641a8

File tree

1 file changed

+9
-12
lines changed

1 file changed

+9
-12
lines changed

bip-???-cat.mediawiki

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -43,18 +43,15 @@ OP_CAT pops two elements off the stack, concatenates them together in stack orde
4343

4444
===Implementation===
4545
<pre>
46-
case OP_CAT:
47-
{
48-
if (stack.size() < 2) {
49-
return set_error(serror, SCRIPT_ERR_INVALID_STACK_OPERATION);
50-
}
51-
valtype& vch1 = stacktop(-2);
52-
valtype& vch2 = stacktop(-1);
53-
if (vch1.size() + vch2.size() > MAX_SCRIPT_ELEMENT_SIZE) {
54-
return set_error(serror, SCRIPT_ERR_INVALID_STACK_OPERATION);
55-
}
56-
vch1.insert(vch1.end(), vch2.begin(), vch2.end());
57-
stack.pop_back();
46+
case OP_CAT: {
47+
if (stack.size() < 2)
48+
return set_error(serror, SCRIPT_ERR_INVALID_STACK_OPERATION);
49+
valtype& vch1 = stacktop(-2);
50+
valtype& vch2 = stacktop(-1);
51+
if (vch1.size() + vch2.size() > MAX_SCRIPT_ELEMENT_SIZE)
52+
return set_error(serror, SCRIPT_ERR_PUSH_SIZE);
53+
vch1.insert(vch1.end(), vch2.begin(), vch2.end());
54+
stack.pop_back();
5855
}
5956
break;
6057
</pre>

0 commit comments

Comments
 (0)