Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
18 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 26 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,32 @@
# 0.7.0-rc.33 (Synonym Fork)
# 0.7.0-rc.36 (Synonym Fork)

## Bug Fixes

- Fixed orphaned channel migration blocking node startup when the existing monitor
in the KV store can't be deserialized (e.g., `UnknownVersion` from a newer LDK
version). The migration now skips writing and lets the node start normally,
preserving the existing monitor data.
- Fixed HTLC timeout force-close during stale monitor recovery. The healing keysend
created HTLCs with a stale `cltv_expiry` (based on the ChannelManager's outdated
best block height for users offline >24h). When chain sync caught up, LDK
force-closed the channel (HTLCsTimedOut). Fix: sync the chain tip before sending
healing payments so HTLCs get a valid CLTV expiry. If sync fails, skip the keysend
to avoid the stale-CLTV force-close.
- Fixed native crash (SIGABRT) during stale channel monitor recovery. The
`CounterpartyCommitmentSecrets` store was not reset when force-syncing the
monitor's `update_id`, causing `provide_secret()` to fail validation after
a few commitment round-trips. The failed update triggered a
`ChannelMonitorUpdateStatus` mode mismatch panic in the ChannelManager.
Fix: reset the secrets store in `force_set_latest_update_id` so new secrets
build a fresh, consistent tree. (rust-lightning fork change)
- Added `BuildError::DangerousValue` variant to distinguish stale channel monitor failures from
the 19 other `ReadFailed` causes. Apps can now catch this specific error to trigger one-shot
recovery without false positives from unrelated I/O or deserialization errors.
- Added `set_accept_stale_channel_monitors` builder API for recovery from channel monitor desync
(e.g., after migration overwrote newer monitors with stale backup data). When enabled,
force-syncs stale monitor update_ids during build, defers chain sync, and sends probes to
trigger commitment round-trips that heal the monitor state. Depends on a patched rust-lightning
fork (`synonymdev/rust-lightning#0.2.2-accept-stale-monitors`).
- Fixed cumulative change-address derivation index leak during fee estimation and dry-run
transaction builds. BDK's `TxBuilder::finish()` advances the internal (change) keychain index
each time it's called; repeated fee estimations would burn through change addresses without
Expand Down
15 changes: 14 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ exclude = ["bindings/uniffi-bindgen"]

[package]
name = "ldk-node"
version = "0.7.0-rc.33"
version = "0.7.0-rc.36"
authors = ["Elias Rohrer <dev@tnull.de>"]
homepage = "https://lightningdevkit.org/"
license = "MIT OR Apache-2.0"
Expand Down Expand Up @@ -123,6 +123,19 @@ check-cfg = [
name = "payments"
harness = false

[patch.crates-io]
lightning = { git = "https://github.com/synonymdev/rust-lightning", branch = "0.2.2-accept-stale-monitors" }
lightning-types = { git = "https://github.com/synonymdev/rust-lightning", branch = "0.2.2-accept-stale-monitors" }
lightning-invoice = { git = "https://github.com/synonymdev/rust-lightning", branch = "0.2.2-accept-stale-monitors" }
lightning-net-tokio = { git = "https://github.com/synonymdev/rust-lightning", branch = "0.2.2-accept-stale-monitors" }
lightning-persister = { git = "https://github.com/synonymdev/rust-lightning", branch = "0.2.2-accept-stale-monitors" }
lightning-background-processor = { git = "https://github.com/synonymdev/rust-lightning", branch = "0.2.2-accept-stale-monitors" }
lightning-rapid-gossip-sync = { git = "https://github.com/synonymdev/rust-lightning", branch = "0.2.2-accept-stale-monitors" }
lightning-block-sync = { git = "https://github.com/synonymdev/rust-lightning", branch = "0.2.2-accept-stale-monitors" }
lightning-transaction-sync = { git = "https://github.com/synonymdev/rust-lightning", branch = "0.2.2-accept-stale-monitors" }
lightning-liquidity = { git = "https://github.com/synonymdev/rust-lightning", branch = "0.2.2-accept-stale-monitors" }
lightning-macros = { git = "https://github.com/synonymdev/rust-lightning", branch = "0.2.2-accept-stale-monitors" }

#[patch.crates-io]
#lightning = { path = "../rust-lightning/lightning" }
#lightning-types = { path = "../rust-lightning/lightning-types" }
Expand Down
4 changes: 2 additions & 2 deletions Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@

import PackageDescription

let tag = "v0.7.0-rc.33"
let checksum = "a6bc32bf63117e80141f9e4cc529d33e16e141460b269125f4150e1251a1108a"
let tag = "v0.7.0-rc.36"
let checksum = "de56fe19149808ccc5e517047ea7bf6b4d5d2c2e33d3ad539ef0155bf1aec8f7"
let url = "https://github.com/synonymdev/ldk-node/releases/download/\(tag)/LDKNodeFFI.xcframework.zip"

let package = Package(
Expand Down
2 changes: 1 addition & 1 deletion bindings/kotlin/ldk-node-android/gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ android.useAndroidX=true
android.enableJetifier=true
kotlin.code.style=official
group=com.synonym
version=0.7.0-rc.33
version=0.7.0-rc.36
Binary file not shown.
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -1517,6 +1517,8 @@ internal typealias UniffiVTableCallbackInterfaceVssHeaderProviderUniffiByValue =








Expand Down Expand Up @@ -1971,6 +1973,11 @@ internal interface UniffiLib : Library {
`headerProvider`: Pointer?,
uniffiCallStatus: UniffiRustCallStatus,
): Pointer?
fun uniffi_ldk_node_fn_method_builder_set_accept_stale_channel_monitors(
`ptr`: Pointer?,
`accept`: Byte,
uniffiCallStatus: UniffiRustCallStatus,
): Unit
fun uniffi_ldk_node_fn_method_builder_set_address_type(
`ptr`: Pointer?,
`addressType`: RustBufferByValue,
Expand Down Expand Up @@ -3123,6 +3130,8 @@ internal interface UniffiLib : Library {
): Short
fun uniffi_ldk_node_checksum_method_builder_build_with_vss_store_and_header_provider(
): Short
fun uniffi_ldk_node_checksum_method_builder_set_accept_stale_channel_monitors(
): Short
fun uniffi_ldk_node_checksum_method_builder_set_address_type(
): Short
fun uniffi_ldk_node_checksum_method_builder_set_address_types_to_monitor(
Expand Down Expand Up @@ -3614,6 +3623,9 @@ private fun uniffiCheckApiChecksums(lib: UniffiLib) {
if (lib.uniffi_ldk_node_checksum_method_builder_build_with_vss_store_and_header_provider() != 9090.toShort()) {
throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
}
if (lib.uniffi_ldk_node_checksum_method_builder_set_accept_stale_channel_monitors() != 25727.toShort()) {
throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
}
if (lib.uniffi_ldk_node_checksum_method_builder_set_address_type() != 647.toShort()) {
throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
}
Expand Down Expand Up @@ -5780,6 +5792,18 @@ open class Builder: Disposable, BuilderInterface {
})
}

override fun `setAcceptStaleChannelMonitors`(`accept`: kotlin.Boolean) {
callWithPointer {
uniffiRustCall { uniffiRustCallStatus ->
UniffiLib.INSTANCE.uniffi_ldk_node_fn_method_builder_set_accept_stale_channel_monitors(
it,
FfiConverterBoolean.lower(`accept`),
uniffiRustCallStatus,
)
}
}
}

override fun `setAddressType`(`addressType`: AddressType) {
callWithPointer {
uniffiRustCall { uniffiRustCallStatus ->
Expand Down Expand Up @@ -10290,13 +10314,14 @@ object FfiConverterTypeBuildError : FfiConverterRustBuffer<BuildException> {
7 -> BuildException.InvalidNodeAlias(FfiConverterString.read(buf))
8 -> BuildException.RuntimeSetupFailed(FfiConverterString.read(buf))
9 -> BuildException.ReadFailed(FfiConverterString.read(buf))
10 -> BuildException.WriteFailed(FfiConverterString.read(buf))
11 -> BuildException.StoragePathAccessFailed(FfiConverterString.read(buf))
12 -> BuildException.KvStoreSetupFailed(FfiConverterString.read(buf))
13 -> BuildException.WalletSetupFailed(FfiConverterString.read(buf))
14 -> BuildException.LoggerSetupFailed(FfiConverterString.read(buf))
15 -> BuildException.NetworkMismatch(FfiConverterString.read(buf))
16 -> BuildException.AsyncPaymentsConfigMismatch(FfiConverterString.read(buf))
10 -> BuildException.DangerousValue(FfiConverterString.read(buf))
11 -> BuildException.WriteFailed(FfiConverterString.read(buf))
12 -> BuildException.StoragePathAccessFailed(FfiConverterString.read(buf))
13 -> BuildException.KvStoreSetupFailed(FfiConverterString.read(buf))
14 -> BuildException.WalletSetupFailed(FfiConverterString.read(buf))
15 -> BuildException.LoggerSetupFailed(FfiConverterString.read(buf))
16 -> BuildException.NetworkMismatch(FfiConverterString.read(buf))
17 -> BuildException.AsyncPaymentsConfigMismatch(FfiConverterString.read(buf))
else -> throw RuntimeException("invalid error enum value, something is very wrong!!")
}
}
Expand Down Expand Up @@ -10343,34 +10368,38 @@ object FfiConverterTypeBuildError : FfiConverterRustBuffer<BuildException> {
buf.putInt(9)
Unit
}
is BuildException.WriteFailed -> {
is BuildException.DangerousValue -> {
buf.putInt(10)
Unit
}
is BuildException.StoragePathAccessFailed -> {
is BuildException.WriteFailed -> {
buf.putInt(11)
Unit
}
is BuildException.KvStoreSetupFailed -> {
is BuildException.StoragePathAccessFailed -> {
buf.putInt(12)
Unit
}
is BuildException.WalletSetupFailed -> {
is BuildException.KvStoreSetupFailed -> {
buf.putInt(13)
Unit
}
is BuildException.LoggerSetupFailed -> {
is BuildException.WalletSetupFailed -> {
buf.putInt(14)
Unit
}
is BuildException.NetworkMismatch -> {
is BuildException.LoggerSetupFailed -> {
buf.putInt(15)
Unit
}
is BuildException.AsyncPaymentsConfigMismatch -> {
is BuildException.NetworkMismatch -> {
buf.putInt(16)
Unit
}
is BuildException.AsyncPaymentsConfigMismatch -> {
buf.putInt(17)
Unit
}
}.let { /* this makes the `when` an expression, which ensures it is exhaustive */ }
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -299,6 +299,8 @@ interface BuilderInterface {
@Throws(BuildException::class)
fun `buildWithVssStoreAndHeaderProvider`(`vssUrl`: kotlin.String, `storeId`: kotlin.String, `headerProvider`: VssHeaderProvider): Node

fun `setAcceptStaleChannelMonitors`(`accept`: kotlin.Boolean)

fun `setAddressType`(`addressType`: AddressType)

fun `setAddressTypesToMonitor`(`addressTypesToMonitor`: List<AddressType>)
Expand Down Expand Up @@ -1294,6 +1296,8 @@ sealed class BuildException(message: String): kotlin.Exception(message) {

class ReadFailed(message: String) : BuildException(message)

class DangerousValue(message: String) : BuildException(message)

class WriteFailed(message: String) : BuildException(message)

class StoragePathAccessFailed(message: String) : BuildException(message)
Expand Down
2 changes: 1 addition & 1 deletion bindings/kotlin/ldk-node-jvm/gradle.properties
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
org.gradle.jvmargs=-Xmx1536m
kotlin.code.style=official
group=com.synonym
version=0.7.0-rc.33
version=0.7.0-rc.36
Original file line number Diff line number Diff line change
Expand Up @@ -299,6 +299,8 @@ interface BuilderInterface {
@Throws(BuildException::class)
fun `buildWithVssStoreAndHeaderProvider`(`vssUrl`: kotlin.String, `storeId`: kotlin.String, `headerProvider`: VssHeaderProvider): Node

fun `setAcceptStaleChannelMonitors`(`accept`: kotlin.Boolean)

fun `setAddressType`(`addressType`: AddressType)

fun `setAddressTypesToMonitor`(`addressTypesToMonitor`: List<AddressType>)
Expand Down Expand Up @@ -1294,6 +1296,8 @@ sealed class BuildException(message: String): kotlin.Exception(message) {

class ReadFailed(message: String) : BuildException(message)

class DangerousValue(message: String) : BuildException(message)

class WriteFailed(message: String) : BuildException(message)

class StoragePathAccessFailed(message: String) : BuildException(message)
Expand Down
Loading
Loading