-
Notifications
You must be signed in to change notification settings - Fork 141
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
compiler: improve logic for deciding between thresholds and ands
In our threshold logic we have some special cases to handle multi, multi_a, and conjunctions. However, we were not choosing between these special cases correctly. Our logic was roughly that we would try to use multi_a if all children were pk()s, OR try to use multi if all children were pk() and there weren't too many, OR try to use a conjunction if k == n. The correct logic is: if all children are keys, and there aren't too many, try to use multi or multi_a. ALSO, if k == n, try to use a conjunction. With this fix, the compiler correctly finds that conjunctions are more efficient than CHECKMULTISIG when k == n and n < 3. When n == 3 the two cases have equal cost, but it seems to prefer the conjunction. It also correctly finds that when k == n, it is always more efficient to use a conjunction than to use CHECKSIGADD. This change necessitates changing some tests.
- Loading branch information
Showing
5 changed files
with
59 additions
and
43 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
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
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