-
Notifications
You must be signed in to change notification settings - Fork 289
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
txscript: Optimize conditional execution mem usage.
The existing implementation to handle conditional execution makes use of a stack to track the state of each nested conditional. It is already fairly efficient in terms of execution costs since it only considers the most recent conditional stack entry and makes use of pushing OpCondSkip to essentially track the nesting depth in unexecuted branches, however, using a stack is less efficient in terms of memory usage than is actually necessary since there is no need to use a stack at all given that all that is really needed to provide the necessary behavior is the current conditional nesting depth and the depth at which branch execution was disabled (if it has been disabled). Given the above, this optimizes the txscript conditional execution logic by replacing the condition stack with two int32 fields to track the aforementioned cases and updates the conditional execution opcode and logic accordingly.
- Loading branch information
Showing
2 changed files
with
97 additions
and
39 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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