@@ -495,7 +495,14 @@ class TransactionsSpec extends AnyFunSuite with Logging {
495495
496496 def generateCommitAndHtlcTxs (commitmentFormat : CommitmentFormat ): Unit = {
497497 val finalPubKeyScript = Script .write(Script .pay2wpkh(PrivateKey (randomBytes32()).publicKey))
498- val commitInput = Funding .makeFundingInputInfo(randomTxId(), 0 , Btc (1 ), localFundingPriv.publicKey, remoteFundingPriv.publicKey, DefaultCommitmentFormat )
498+ // funding tx sends to musig2 aggregate of local and remote funding keys
499+ val fundingTx = commitmentFormat match {
500+ case SimpleTaprootChannelCommitmentFormat => Transaction (version = 2 , txIn = Nil , txOut = TxOut (Btc (1 ), Script .pay2tr(Taproot .musig2Aggregate(localFundingPriv.publicKey, remoteFundingPriv.publicKey), None )) :: Nil , lockTime = 0 )
501+ case DefaultCommitmentFormat | _ : AnchorOutputsCommitmentFormat => Transaction (version = 2 , txIn = Nil , txOut = TxOut (Btc (1 ), Scripts .multiSig2of2(localFundingPriv.publicKey, remoteFundingPriv.publicKey)) :: Nil , lockTime = 0 )
502+ }
503+ val fundingTxOutpoint = OutPoint (fundingTx.txid, 0 )
504+ val fundingOutput = fundingTx.txOut(0 )
505+ val commitInput = Funding .makeFundingInputInfo(fundingTxOutpoint.txid, fundingTxOutpoint.index.toInt, Btc (1 ), localFundingPriv.publicKey, remoteFundingPriv.publicKey, commitmentFormat)
499506
500507 // htlc1, htlc2a and htlc2b are regular IN/OUT htlcs
501508 val paymentPreimage1 = randomBytes32()
@@ -691,7 +698,6 @@ class TransactionsSpec extends AnyFunSuite with Logging {
691698 val remoteSig = htlcSuccessTx.sign(remoteHtlcPriv, TxOwner .Remote , commitmentFormat)
692699 val signedTx = addSigs(htlcSuccessTx, localSig, remoteSig, paymentPreimage, commitmentFormat)
693700 assert(checkSpendable(signedTx).isSuccess)
694- assert(signedTx.tx.weight() == SimpleTaprootChannelCommitmentFormat .htlcSuccessWeight)
695701 // check remote sig
696702 assert(htlcSuccessTx.checkSig(remoteSig, remoteHtlcPriv.publicKey, TxOwner .Remote , commitmentFormat))
697703 assertWeightMatches(signedTx.tx.weight(), commitmentFormat.htlcSuccessWeight, commitmentFormat)
0 commit comments