Skip to content

Commit 6d76f8e

Browse files
authored
Update bitcoin-kmp (taproot tweak refactor) (#842)
We also update secp256k1-kmp (android build update).
1 parent 2b7994f commit 6d76f8e

File tree

4 files changed

+7
-7
lines changed

4 files changed

+7
-7
lines changed

gradle/libs.versions.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ kotlinx-coroutines = "1.10.2"
44
kotlinx-datetime = "0.7.1"
55
kotlinx-serialization = "1.9.0"
66
ktor = "3.3.0"
7-
bitcoinkmp = "0.28.1" # when upgrading bitcoin-kmp, keep secpjnijvm in sync!
8-
secpjnijvm = "0.21.0"
7+
bitcoinkmp = "0.29.0" # when upgrading bitcoin-kmp, keep secpjnijvm in sync!
8+
secpjnijvm = "0.22.0"
99
kermit = "2.0.8"
1010
slf4j = "2.0.17"
1111

modules/core/src/commonMain/kotlin/fr/acinq/lightning/transactions/Transactions.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ object Transactions {
141141
* @param scriptTree_opt the script tree must be known if there is one, even when spending via the key path.
142142
*/
143143
data class TaprootKeyPath(val internalKey: XonlyPublicKey, val scriptTree_opt: ScriptTree?) : RedeemInfo() {
144-
override val pubkeyScript: ByteVector = Script.write(Script.pay2tr(internalKey, scriptTree_opt)).byteVector()
144+
override val pubkeyScript: ByteVector = Script.write(Script.pay2tr(internalKey, scriptTree_opt?.let { Crypto.TaprootTweak.ScriptPathTweak(it.hash()) } ?: Crypto.TaprootTweak.KeyPathTweak)).byteVector()
145145
}
146146

147147
/**

modules/core/src/commonMain/kotlin/fr/acinq/lightning/wire/OfferTypes.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1100,7 +1100,7 @@ object OfferTypes {
11001100
fun signSchnorr(tag: ByteVector, msg: ByteVector32, key: PrivateKey): ByteVector64 {
11011101
val h = ByteVector32(hash(tag.toByteArray(), msg.toByteArray()))
11021102
// NB: we don't add auxiliary random data to keep signatures deterministic.
1103-
return Crypto.signSchnorr(h, key, Crypto.SchnorrTweak.NoTweak)
1103+
return Crypto.signSchnorr(h, key, null)
11041104
}
11051105

11061106
fun verifySchnorr(tag: ByteVector, msg: ByteVector32, signature: ByteVector64, publicKey: PublicKey): Boolean {

modules/core/src/commonTest/kotlin/fr/acinq/lightning/channel/HelpersTestsCommon.kt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ class HelpersTestsCommon : LightningTestSuite() {
5757
TxOut(539.sat, Script.pay2sh(Hex.decode("0000000000000000000000000000000000000000"))),
5858
TxOut(293.sat, Script.pay2wpkh(randomKey().publicKey())),
5959
TxOut(329.sat, Script.pay2wsh(Hex.decode("0000000000000000000000000000000000000000"))),
60-
TxOut(353.sat, Script.pay2tr(randomKey().publicKey().xOnly())),
60+
TxOut(353.sat, Script.pay2tr(randomKey().publicKey().xOnly(), Crypto.TaprootTweak.KeyPathTweak)),
6161
)
6262
outputsBelowDust.forEach { assertTrue(it.amount < Transactions.dustLimit(it.publicKeyScript)) }
6363

@@ -66,7 +66,7 @@ class HelpersTestsCommon : LightningTestSuite() {
6666
TxOut(540.sat, Script.pay2sh(Hex.decode("0000000000000000000000000000000000000000"))),
6767
TxOut(294.sat, Script.pay2wpkh(randomKey().publicKey())),
6868
TxOut(330.sat, Script.pay2wsh(Hex.decode("0000000000000000000000000000000000000000"))),
69-
TxOut(354.sat, Script.pay2tr(randomKey().publicKey().xOnly())),
69+
TxOut(354.sat, Script.pay2tr(randomKey().publicKey().xOnly(), Crypto.TaprootTweak.KeyPathTweak)),
7070
TxOut(0.sat, listOf(OP_RETURN, OP_PUSHDATA(Hex.decode("deadbeef")))),
7171
)
7272
outputsAboveDust.forEach { assertTrue(it.amount >= Transactions.dustLimit(it.publicKeyScript)) }
@@ -79,7 +79,7 @@ class HelpersTestsCommon : LightningTestSuite() {
7979
Script.write(Script.pay2sh(Hex.decode("deadbeef"))).byteVector(),
8080
Script.write(Script.pay2wpkh(randomKey().publicKey())).byteVector(),
8181
Script.write(Script.pay2wsh(Hex.decode("deadbeef"))).byteVector(),
82-
Script.write(Script.pay2tr(randomKey().publicKey().xOnly())).byteVector(),
82+
Script.write(Script.pay2tr(randomKey().publicKey().xOnly(), Crypto.TaprootTweak.KeyPathTweak)).byteVector(),
8383
Script.write(listOf(OP_RETURN, OP_PUSHDATA(Hex.decode("deadbeefdeadbeef")))).byteVector(),
8484
)
8585
validScripts.forEach { assertTrue(isValidFinalScriptPubkey(it, allowAnySegwit = true, allowOpReturn = true)) }

0 commit comments

Comments
 (0)