Skip to content

Commit 612ad05

Browse files
authored
Merge pull request #25 from synonymdev/migrate-old-ldk
Add channel data migration from external LDK implementations
2 parents 47bfd94 + 2b3a14d commit 612ad05

File tree

16 files changed

+307
-12
lines changed

16 files changed

+307
-12
lines changed

CHANGELOG.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# 0.7.0-rc.1 (Synonym Fork)
1+
# 0.7.0-rc.2 (Synonym Fork)
22

33
## Synonym Fork Additions
44
- Added reactive event system for wallet monitoring without polling:
@@ -51,6 +51,10 @@
5151
from external wallets). Default is `false` for safety, as spending unconfirmed external funds
5252
carries risk of double-spending. This affects all balance reporting including `list_balances()`
5353
and `BalanceChanged` events.
54+
- Added `ChannelDataMigration` struct and `Builder::set_channel_data_migration()` method to migrate
55+
channel data from external LDK implementations (e.g., react-native-ldk). The channel manager and
56+
monitor data is written to the configured storage during build, before channel monitors are read.
57+
Storage keys for monitors are derived from the funding outpoint.
5458

5559
# 0.7.0 - Dec. 3, 2025
5660
This seventh minor release introduces numerous new features, bug fixes, and API improvements. In particular, it adds support for channel Splicing, Async Payments, as well as sourcing chain data from a Bitcoin Core REST backend.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "ldk-node"
3-
version = "0.7.0-rc.1"
3+
version = "0.7.0-rc.2"
44
authors = ["Elias Rohrer <[email protected]>"]
55
homepage = "https://lightningdevkit.org/"
66
license = "MIT OR Apache-2.0"

Package.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33

44
import PackageDescription
55

6-
let tag = "v0.7.0-rc.1"
7-
let checksum = "2e44a30a302b3d1a934e7e212c691161b0cb6f4d367593b9e555d53d401830d3"
6+
let tag = "v0.7.0-rc.2"
7+
let checksum = "02b7edc2f3fcf2b8a1c914bd1f03e8a3bf2aca2281a2314d0d03cb7547ecd11a"
88
let url = "https://github.com/synonymdev/ldk-node/releases/download/\(tag)/LDKNodeFFI.xcframework.zip"
99

1010
let package = Package(

bindings/kotlin/ldk-node-android/gradle.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@ org.gradle.jvmargs=-Xmx1536m
22
android.useAndroidX=true
33
android.enableJetifier=true
44
kotlin.code.style=official
5-
libraryVersion=0.7.0-rc.1
5+
libraryVersion=0.7.0-rc.2
Binary file not shown.
Binary file not shown.
Binary file not shown.

bindings/kotlin/ldk-node-android/lib/src/main/kotlin/org/lightningdevkit/ldknode/ldk_node.android.kt

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1485,6 +1485,8 @@ internal typealias UniffiVTableCallbackInterfaceVssHeaderProviderUniffiByValue =
14851485

14861486

14871487

1488+
1489+
14881490

14891491

14901492

@@ -1979,6 +1981,11 @@ internal interface UniffiLib : Library {
19791981
`config`: RustBufferByValue,
19801982
uniffiCallStatus: UniffiRustCallStatus,
19811983
): Unit
1984+
fun uniffi_ldk_node_fn_method_builder_set_channel_data_migration(
1985+
`ptr`: Pointer?,
1986+
`migration`: RustBufferByValue,
1987+
uniffiCallStatus: UniffiRustCallStatus,
1988+
): Unit
19821989
fun uniffi_ldk_node_fn_method_builder_set_custom_logger(
19831990
`ptr`: Pointer?,
19841991
`logWriter`: Pointer?,
@@ -3015,6 +3022,8 @@ internal interface UniffiLib : Library {
30153022
): Short
30163023
fun uniffi_ldk_node_checksum_method_builder_set_chain_source_esplora(
30173024
): Short
3025+
fun uniffi_ldk_node_checksum_method_builder_set_channel_data_migration(
3026+
): Short
30183027
fun uniffi_ldk_node_checksum_method_builder_set_custom_logger(
30193028
): Short
30203029
fun uniffi_ldk_node_checksum_method_builder_set_entropy_bip39_mnemonic(
@@ -3478,6 +3487,9 @@ private fun uniffiCheckApiChecksums(lib: UniffiLib) {
34783487
if (lib.uniffi_ldk_node_checksum_method_builder_set_chain_source_esplora() != 1781.toShort()) {
34793488
throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
34803489
}
3490+
if (lib.uniffi_ldk_node_checksum_method_builder_set_channel_data_migration() != 58453.toShort()) {
3491+
throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
3492+
}
34813493
if (lib.uniffi_ldk_node_checksum_method_builder_set_custom_logger() != 51232.toShort()) {
34823494
throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
34833495
}
@@ -5668,6 +5680,18 @@ open class Builder: Disposable, BuilderInterface {
56685680
}
56695681
}
56705682

5683+
override fun `setChannelDataMigration`(`migration`: ChannelDataMigration) {
5684+
callWithPointer {
5685+
uniffiRustCall { uniffiRustCallStatus ->
5686+
UniffiLib.INSTANCE.uniffi_ldk_node_fn_method_builder_set_channel_data_migration(
5687+
it,
5688+
FfiConverterTypeChannelDataMigration.lower(`migration`),
5689+
uniffiRustCallStatus,
5690+
)
5691+
}
5692+
}
5693+
}
5694+
56715695
override fun `setCustomLogger`(`logWriter`: LogWriter) {
56725696
callWithPointer {
56735697
uniffiRustCall { uniffiRustCallStatus ->
@@ -8781,6 +8805,28 @@ object FfiConverterTypeChannelConfig: FfiConverterRustBuffer<ChannelConfig> {
87818805

87828806

87838807

8808+
object FfiConverterTypeChannelDataMigration: FfiConverterRustBuffer<ChannelDataMigration> {
8809+
override fun read(buf: ByteBuffer): ChannelDataMigration {
8810+
return ChannelDataMigration(
8811+
FfiConverterOptionalSequenceUByte.read(buf),
8812+
FfiConverterSequenceSequenceUByte.read(buf),
8813+
)
8814+
}
8815+
8816+
override fun allocationSize(value: ChannelDataMigration) = (
8817+
FfiConverterOptionalSequenceUByte.allocationSize(value.`channelManager`) +
8818+
FfiConverterSequenceSequenceUByte.allocationSize(value.`channelMonitors`)
8819+
)
8820+
8821+
override fun write(value: ChannelDataMigration, buf: ByteBuffer) {
8822+
FfiConverterOptionalSequenceUByte.write(value.`channelManager`, buf)
8823+
FfiConverterSequenceSequenceUByte.write(value.`channelMonitors`, buf)
8824+
}
8825+
}
8826+
8827+
8828+
8829+
87848830
object FfiConverterTypeChannelDetails: FfiConverterRustBuffer<ChannelDetails> {
87858831
override fun read(buf: ByteBuffer): ChannelDetails {
87868832
return ChannelDetails(

bindings/kotlin/ldk-node-android/lib/src/main/kotlin/org/lightningdevkit/ldknode/ldk_node.common.kt

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -313,6 +313,8 @@ interface BuilderInterface {
313313

314314
fun `setChainSourceEsplora`(`serverUrl`: kotlin.String, `config`: EsploraSyncConfig?)
315315

316+
fun `setChannelDataMigration`(`migration`: ChannelDataMigration)
317+
316318
fun `setCustomLogger`(`logWriter`: LogWriter)
317319

318320
fun `setEntropyBip39Mnemonic`(`mnemonic`: Mnemonic, `passphrase`: kotlin.String?)
@@ -712,6 +714,16 @@ data class ChannelConfig (
712714

713715

714716

717+
@kotlinx.serialization.Serializable
718+
data class ChannelDataMigration (
719+
val `channelManager`: List<kotlin.UByte>?,
720+
val `channelMonitors`: List<List<kotlin.UByte>>
721+
) {
722+
companion object
723+
}
724+
725+
726+
715727
@kotlinx.serialization.Serializable
716728
data class ChannelDetails (
717729
val `channelId`: ChannelId,
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
org.gradle.jvmargs=-Xmx1536m
22
kotlin.code.style=official
3-
libraryVersion=0.7.0-rc.1
3+
libraryVersion=0.7.0-rc.2

0 commit comments

Comments
 (0)