script: add OP_TRUE and OP_FALSE aliases to OPCODES_BY_NAME#317
Open
Bortlesboat wants to merge 2 commits into
Open
script: add OP_TRUE and OP_FALSE aliases to OPCODES_BY_NAME#317Bortlesboat wants to merge 2 commits into
Bortlesboat wants to merge 2 commits into
Conversation
These aliases are already defined as module-level constants (OP_FALSE = OP_0, OP_TRUE = OP_1) but were missing from the OPCODES_BY_NAME lookup dict, making it impossible to parse script strings containing these common aliases. Fixes petertodd#225
Author
|
Added focused coverage asserting the name table maps OP_FALSE to the OP_0 singleton and OP_TRUE to OP_1. All 19 script tests pass. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
OP_TRUEandOP_FALSEalready exist as aliases forOP_1andOP_0, but they are absent fromOPCODES_BY_NAME. Code that parses textual script tokens therefore cannot resolve these standard boolean names.Add both aliases to the lookup table, as requested by a repository collaborator in issue #225, and cover their exact singleton mappings.
Fixes #225.
Verification
python -m unittest bitcoin.tests.test_script -v— 19 passed.