Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix script-level locktime encoding #41

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

Amir-m-a
Copy link
Contributor

@Amir-m-a Amir-m-a commented Jan 2, 2025

After changing locktime from 500 to 200 in the original code, the following error occurs (v24.0.1 is used):

'reject-reason': 'non-mandatory-script-verify-flag (unknown error)'

Apparently locktime should be encoded minimally in the script and since 2 bytes is used for 200, which can fit in a single byte, the error is raised. Also if locktime <= 16 then OP_1 to OP_16 can be used.

Same goes for the solution of exercise but since 398 also needs 2 bytes, no change is needed.

This PR doesn't change the locktime value and only adds the code to handle other cases for OP_CLTV.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant