Skip to content

Commit

Permalink
Make Musig2.taprootSession() public
Browse files Browse the repository at this point in the history
  • Loading branch information
sstone committed May 27, 2024
1 parent d6bcba6 commit c3e7932
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion src/commonMain/kotlin/fr/acinq/bitcoin/crypto/musig2/Musig2.kt
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,18 @@ public object Musig2 {
return SecretNonce.generate(sessionId, privateKey, privateKey.publicKey(), message = null, keyAggCache, extraInput = null)
}

private fun taprootSession(tx: Transaction, inputIndex: Int, inputs: List<TxOut>, publicKeys: List<PublicKey>, publicNonces: List<IndividualNonce>, scriptTree: ScriptTree?): Either<Throwable, Session> {
/**
* Create a musig2 session for a given transaction input.
*
* @param tx transaction
* @param inputIndex transaction input index
* @param inputs outputs spent by this transaction
* @param publicKeys signers' public keys
* @param publicNonces signers' public nonces
* @param scriptTree tapscript tree of the transaction's input, if it has script paths.
*/
@JvmStatic
public fun taprootSession(tx: Transaction, inputIndex: Int, inputs: List<TxOut>, publicKeys: List<PublicKey>, publicNonces: List<IndividualNonce>, scriptTree: ScriptTree?): Either<Throwable, Session> {
return IndividualNonce.aggregate(publicNonces).flatMap { aggregateNonce ->
val (aggregatePublicKey, keyAggCache) = KeyAggCache.create(publicKeys)
val tweak = when (scriptTree) {
Expand Down

0 comments on commit c3e7932

Please sign in to comment.