multi: add tag option to SignMessageSchnorr

This commit is contained in:
Orbital committed 2023-10-30 21:39:39 -05:00
1 parent dd81edd817
commit ed373baed0
5 files changed
+23 -13

No files matched your search

+8 -4
View File
@@ -74,13 +74,17 @@ func (s *SecretKeyRing) SignMessageCompact(_ keychain.KeyLocator,
// SignMessageSchnorr signs the passed message and ignores the KeyDescriptor.
func (s *SecretKeyRing) SignMessageSchnorr(_ keychain.KeyLocator,
msg []byte, doubleHash bool, taprootTweak []byte) (*schnorr.Signature,
error) {
msg []byte, doubleHash bool, taprootTweak []byte,
tag []byte) (*schnorr.Signature, error) {
var digest []byte
if doubleHash {
switch {
case len(tag) > 0:
taggedHash := chainhash.TaggedHash(tag, msg)
digest = taggedHash[:]
case doubleHash:
digest = chainhash.DoubleHashB(msg)
} else {
default:
digest = chainhash.HashB(msg)
}