Skip to content

OP_CHECKLOCKTIMEVERIFY does not accept 5-byte scriptNums #51

@dgpv

Description

@dgpv

when entering the following script in ScriptWiz app (https://ide.scriptwiz.app/):

<0x0100008000000000> // timestamp
OP_DUP // copy timestamp
<0x0000008000000000>
OP_GREATERTHANOREQUAL64
OP_IF
// If timestamp does not fit into 4-byte scriptnum, we will just take 5 lower
// bytes of it. This will allow to use locktimes up to year 2106
<0>
<5>
OP_SUBSTR
OP_ELSE
// If timestamp fits into 4-byte scriptnum, just convert it
OP_LE64TOSCRIPTNUM
OP_ENDIF

// timestamp in scriptnum format is now on top of the stack
OP_CHECKLOCKTIMEVERIFY
OP_DROP

I get the following error at OP_CHECKLOCKTIMEVERIFY: Error: Invalid input: this operation requires a valid Script Number

The number on the stack at this time is 0x0100008000 - a 5-byte scriptnum.

CLTV, as a special case, accepts scriptnums of 5-byte length, to avoid y2038 problem. It seems that ScriptWiz interpreter does not account for this special case.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions