2

Does the OP_SIZE operation in Script push one item onto the stack (length of the string), or two (string and its length)?

3

It pushes one item onto the stack, the size of the item on the top of the stack. The item whose size it pushes onto the stack is not consumed, it becomes the second item on the stack.

Here's the source code:

            case OP_SIZE:
            {
                // (in -- in size)
                if (stack.size() < 1)
                    return false;
                CBigNum bn(stacktop(-1).size());
                stack.push_back(bn.getvch());
            }
            break

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.