Skip to content

Why checking the lower bound of a digit? #35

@SergioDemianLerner

Description

@SergioDemianLerner

The following code checks the bounds of each Winternitz digit:

OP_VERIFY

This full check doesn't seem to be required. If the digit is negative, then OP_PICK will fail.

Therefore the following code could be replaced:

OP_DUP
 0
 { D + 1 }
 OP_WITHIN 
 OP_VERIFY

by

 OP_DUP
 { D + 1 }
 OP_LESSTHAN
 OP_VERIFY

If we don't care about digit uniqueness, we can reduce the size further and just limit it to D:

 { D }
 OP_MIN

3 opcodes are saved.
Am I missing something?

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