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.
overview
This patch assign cost to some (currently unknown) condition codes, when the
ENABLE_SOFTFORK_CONDITION
flag is set. Setting this flag is a hard fork, and so is changing the costs of unknown conditions. This flag is intended to be set when the 2.0 hard fork activates.The rationale for this change is to enable adding new conditions with cost as soft forks in the future. It is already possible to soft-fork in new conditions, but they must all have cost 0, since all unknown conditions currently have 0 cost.
the details
Currently, all defined condition codes fit in 1 byte, so
ConditionOpcode
is an alias foru8
. This patch changes this to be an alias foru16
. This allows the conditions parser to handle 2-byte conditions.When the flag
ENABLE_SOFTFORK_CONDITION
is enabled, any 2-byte condition opcode whose first byte is0x01
is assigned a cost equal to the second bytes value AND 0x07 multiplied by 200000, plus 1'000'000.examples