Skip to content
Merged
Show file tree
Hide file tree
Changes from 15 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
17 changes: 16 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,22 @@
# 0.7.0-rc.33 (Synonym Fork)
# 0.7.0-rc.35 (Synonym Fork)

## Bug Fixes

- 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 (`ovitrif/rust-lightning#0.2.2-accept-stale-monitors-v2`).
- 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.35"
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/ovitrif/rust-lightning", branch = "0.2.2-accept-stale-monitors-v2" }
lightning-types = { git = "https://github.com/ovitrif/rust-lightning", branch = "0.2.2-accept-stale-monitors-v2" }
lightning-invoice = { git = "https://github.com/ovitrif/rust-lightning", branch = "0.2.2-accept-stale-monitors-v2" }
lightning-net-tokio = { git = "https://github.com/ovitrif/rust-lightning", branch = "0.2.2-accept-stale-monitors-v2" }
lightning-persister = { git = "https://github.com/ovitrif/rust-lightning", branch = "0.2.2-accept-stale-monitors-v2" }
lightning-background-processor = { git = "https://github.com/ovitrif/rust-lightning", branch = "0.2.2-accept-stale-monitors-v2" }
lightning-rapid-gossip-sync = { git = "https://github.com/ovitrif/rust-lightning", branch = "0.2.2-accept-stale-monitors-v2" }
lightning-block-sync = { git = "https://github.com/ovitrif/rust-lightning", branch = "0.2.2-accept-stale-monitors-v2" }
lightning-transaction-sync = { git = "https://github.com/ovitrif/rust-lightning", branch = "0.2.2-accept-stale-monitors-v2" }
lightning-liquidity = { git = "https://github.com/ovitrif/rust-lightning", branch = "0.2.2-accept-stale-monitors-v2" }
lightning-macros = { git = "https://github.com/ovitrif/rust-lightning", branch = "0.2.2-accept-stale-monitors-v2" }

#[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.35"
let checksum = "c9e0da5dfb353a7540c57f5547d3839cff4e914e4f2bbc796adbd24b9ee54fa0"
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.35
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.35
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
Original file line number Diff line number Diff line change
Expand Up @@ -1515,6 +1515,8 @@ internal typealias UniffiVTableCallbackInterfaceVssHeaderProviderUniffiByValue =








Expand Down Expand Up @@ -1969,6 +1971,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 @@ -3121,6 +3128,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 @@ -3612,6 +3621,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 @@ -5769,6 +5781,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 @@ -10279,13 +10303,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 @@ -10332,34 +10357,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
Binary file not shown.
Binary file not shown.
2 changes: 2 additions & 0 deletions bindings/ldk_node.udl
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@ interface Builder {
void set_entropy_seed_bytes(sequence<u8> seed_bytes);
void set_entropy_bip39_mnemonic(Mnemonic mnemonic, string? passphrase);
void set_channel_data_migration(ChannelDataMigration migration);
void set_accept_stale_channel_monitors(boolean accept);
void set_chain_source_esplora(string server_url, EsploraSyncConfig? config);
void set_chain_source_electrum(string server_url, ElectrumSyncConfig? config);
void set_chain_source_bitcoind_rpc(string rpc_host, u16 rpc_port, string rpc_user, string rpc_password);
Expand Down Expand Up @@ -457,6 +458,7 @@ enum BuildError {
"InvalidNodeAlias",
"RuntimeSetupFailed",
"ReadFailed",
"DangerousValue",
"WriteFailed",
"StoragePathAccessFailed",
"KVStoreSetupFailed",
Expand Down
2 changes: 1 addition & 1 deletion bindings/python/pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[project]
name = "ldk_node"
version = "0.7.0-rc.33"
version = "0.7.0-rc.35"
authors = [
{ name="Elias Rohrer", email="dev@tnull.de" },
]
Expand Down
Loading
Loading