Skip to content

Commit ce20057

Browse files
committed
fixup! Add high-level helpers for using Musig2 with Taproot
1 parent 9528832 commit ce20057

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/commonTest/kotlin/fr/acinq/bitcoin/Musig2TestsCommon.kt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -323,11 +323,11 @@ class Musig2TestsCommon {
323323

324324
// the redeem script is just the refund script. it is generated from this policy: and_v(v:pk(user),older(refundDelay))
325325
// it does not depend upon the user's or server's key, just the user's refund key and the refund delay
326-
val redeemScript = listOf(OP_PUSHDATA(userRefundPrivateKey.publicKey().xOnly()), OP_CHECKSIGVERIFY, OP_PUSHDATA(Script.encodeNumber(refundDelay)), OP_CHECKSEQUENCEVERIFY)
326+
val redeemScript = listOf(OP_PUSHDATA(userRefundPrivateKey.xOnlyPublicKey()), OP_CHECKSIGVERIFY, OP_PUSHDATA(Script.encodeNumber(refundDelay)), OP_CHECKSEQUENCEVERIFY)
327327
val scriptTree = ScriptTree.Leaf(0, redeemScript)
328328

329329
// the internal pubkey is the musig2 aggregation of the user's and server's public keys: it does not depend upon the user's refund's key
330-
val aggregatedKey = Musig2.keyAgg(listOf(userPrivateKey.publicKey(), serverPrivateKey.publicKey())).xOnly()
330+
val aggregatedKey = Musig2.keyAgg(listOf(userPublicKey, serverPublicKey)).xOnly()
331331
val pubkeyScript = Script.pay2tr(aggregatedKey, scriptTree)
332332

333333
val swapInTx = Transaction(
@@ -366,7 +366,7 @@ class Musig2TestsCommon {
366366
val tx = Transaction(
367367
version = 2,
368368
txIn = listOf(TxIn(OutPoint(swapInTx, 0), sequence = refundDelay.toLong())),
369-
txOut = listOf(TxOut(Satoshi(10000), Script.pay2wpkh(userPrivateKey.publicKey()))),
369+
txOut = listOf(TxOut(Satoshi(10000), Script.pay2wpkh(userPublicKey))),
370370
lockTime = 0
371371
)
372372
val sig = Crypto.signTaprootScriptPath(userRefundPrivateKey, tx, 0, swapInTx.txOut, SigHash.SIGHASH_DEFAULT, scriptTree.hash())

0 commit comments

Comments
 (0)