tests: refactor tagged hash verification #1725
Open
+36
−51
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.
Opened in response to #1698 (comment)
We use tagged hashes in
modules/musig
,modules/schnorrsig
,modules/ellswift
, and the proposedmodules/silentpayments
. In looking for inspiration on how to add tagged hash midstate verification for #1698, it seemed like a good opportunity to DRY up the code across all of the modules.I chose the convention used in the musig module as this seemed the most readable to me as a reviewer, and also allows for easily grepping for the string values. Since the tags are normally specified as strings in the BIPs, using the string values in the tests seems preferable to specifying the tags character by character (as was done in the schnorrsig and ellswift modules).
If its deemed too invasive to refactor the existing modules in this PR, I'm happy to drop the refactor commits for the ellswift and schnorrsig modules. All I need for #1698 is the first commit which moves the utility function out of the musig module to make it available to use in the silent payments module.