Skip to content

Commit

Permalink
Apply latest bitcoin-kmp musig2 changes
Browse files Browse the repository at this point in the history
  • Loading branch information
sstone committed Dec 6, 2023
1 parent fe20db0 commit cf0c81b
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 6 deletions.
5 changes: 5 additions & 0 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,11 @@ kotlin {
}
}

configurations.all {
// do not cache changing (i.e. SNAPSHOT) dependencies
resolutionStrategy.cacheChangingModulesFor(0, TimeUnit.SECONDS)
}

sourceSets.all {
languageSettings.optIn("kotlin.RequiresOptIn")
languageSettings.optIn("kotlin.ExperimentalStdlibApi")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -599,7 +599,7 @@ object Deserialization {

private fun Input.readTxId(): TxId = TxId(readByteVector32())

private fun Input.readPublicNonce() = IndividualNonce.fromBin(ByteArray(66).also { read(it, 0, it.size) })
private fun Input.readPublicNonce() = IndividualNonce(ByteArray(66).also { read(it, 0, it.size) })

private fun Input.readDelimitedByteArray(): ByteArray {
val size = readNumber().toInt()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ sealed class TxCompleteTlv : Tlv {
const val tag: Long = 101
override fun read(input: Input): Nonces {
val count = input.availableBytes / 66
val nonces = (0 until count).map { IndividualNonce.fromBin(LightningCodecs.bytes(input, 66)) }
val nonces = (0 until count).map { IndividualNonce(LightningCodecs.bytes(input, 66)) }
return Nonces(nonces)
}
}
Expand Down Expand Up @@ -146,7 +146,7 @@ sealed class TxSignaturesTlv : Tlv {
val count = input.availableBytes / (32 + 66)
val psigs = (0 until count).map {
val sig = LightningCodecs.bytes(input, 32).byteVector32()
val nonce = AggregatedNonce.fromBin(LightningCodecs.bytes(input, 66))
val nonce = AggregatedNonce(LightningCodecs.bytes(input, 66))
TxSignatures.Companion.PartialSignature(sig, nonce)
}
return SwapInUserPartialSigs(psigs)
Expand All @@ -167,7 +167,7 @@ sealed class TxSignaturesTlv : Tlv {
val count = input.availableBytes / (32 + 66)
val psigs = (0 until count).map {
val sig = LightningCodecs.bytes(input, 32).byteVector32()
val nonce = AggregatedNonce.fromBin(LightningCodecs.bytes(input, 66))
val nonce = AggregatedNonce(LightningCodecs.bytes(input, 66))
TxSignatures.Companion.PartialSignature(sig, nonce)
}
return SwapInServerPartialSigs(psigs)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -378,8 +378,8 @@ class LightningCodecsTestsCommon : LightningTestSuite() {
val pubKey1 = PrivateKey.fromHex("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa").publicKey()
val pubKey2 = PrivateKey.fromHex("bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb").publicKey()
val swapInPartialSignatures = listOf(
TxSignatures.Companion.PartialSignature(ByteVector32("cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc"), AggregatedNonce(pubKey1, pubKey2)),
TxSignatures.Companion.PartialSignature(ByteVector32("dddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd"), AggregatedNonce(pubKey1, pubKey2))
TxSignatures.Companion.PartialSignature(ByteVector32("cccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc"), AggregatedNonce(pubKey1.value + pubKey2.value)),
TxSignatures.Companion.PartialSignature(ByteVector32("dddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddddd"), AggregatedNonce(pubKey1.value + pubKey2.value))
)
val signature = ByteVector64("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaabbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb")
// This is a random mainnet transaction.
Expand Down

0 comments on commit cf0c81b

Please sign in to comment.