Skip to content

Commit d5b2f89

Browse files
committed
asset: test group key tweaks with taptweak added
1 parent d4f5e17 commit d5b2f89

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

asset/asset_test.go

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -641,6 +641,24 @@ func TestAssetGroupKey(t *testing.T) {
641641
schnorr.SerializePubKey(&keyGroup.GroupPubKey),
642642
)
643643

644+
// We should also be able to reproduce the correct tweak with a non-nil
645+
// tapscript root.
646+
tapTweak := test.RandBytes(32)
647+
tweakedKey = txscript.TweakTaprootPrivKey(*internalKey, tapTweak)
648+
649+
groupReq = NewGroupKeyRequestNoErr(
650+
t, test.PubToKeyDesc(privKey.PubKey()), g, protoAsset, tapTweak,
651+
)
652+
keyGroup, err = DeriveCustomGroupKey(
653+
genSigner, &genBuilder, *groupReq, nil, nil,
654+
)
655+
require.NoError(t, err)
656+
657+
require.Equal(
658+
t, schnorr.SerializePubKey(tweakedKey.PubKey()),
659+
schnorr.SerializePubKey(&keyGroup.GroupPubKey),
660+
)
661+
644662
// Group key tweaking should fail when given invalid tweaks.
645663
badTweak := test.RandBytes(33)
646664
_, err = GroupPubKey(groupPub, badTweak, badTweak)

0 commit comments

Comments
 (0)