Skip to content

Commit d1d6fff

Browse files
authored
Merge pull request #75 from synonymdev/electrum-connection-fix
Add Electrum connection timeout to prevent thread pool exhaustion
2 parents c5698d0 + 86337be commit d1d6fff

23 files changed

Lines changed: 568 additions & 456 deletions

File tree

CHANGELOG.md

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

33
## Bug Fixes
44

@@ -29,6 +29,14 @@
2929

3030
## Synonym Fork Additions
3131

32+
- Added `connection_timeout_secs` field to `ElectrumSyncConfig` (default: 10 s). This bounds
33+
Electrum socket operations for both the BDK on-chain and LDK tx-sync clients, preventing Tokio's
34+
blocking thread pool from being exhausted by threads stuck on dead sockets under total packet
35+
loss (e.g. a captive portal on iOS). Set to `0` to disable; values above 255 are capped to
36+
255 and a warning is logged.
37+
**Breaking change:** existing struct-literal construction of `ElectrumSyncConfig` must add the
38+
new field or switch to `ElectrumSyncConfig { .., ..Default::default() }`.
39+
3240
- Added `OnchainPayment::calculate_send_all_fee()` to preview the fee for a drain / send-all
3341
transaction before broadcasting (fee-calculation counterpart of `send_all_to_address`)
3442
- Added runtime APIs for dynamic address type management:

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ exclude = ["bindings/uniffi-bindgen"]
44

55
[package]
66
name = "ldk-node"
7-
version = "0.7.0-rc.32"
7+
version = "0.7.0-rc.33"
88
authors = ["Elias Rohrer <dev@tnull.de>"]
99
homepage = "https://lightningdevkit.org/"
1010
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.32"
7-
let checksum = "89d987f390e0f8fae370c6d549aacd8b8e1c3c95fb0d6e9ccfcf216cbd263b38"
6+
let tag = "v0.7.0-rc.33"
7+
let checksum = "82e318ac605e04d87f1aa24c920c06627346d9500c6395db45cb23f159e200f0"
88
let url = "https://github.com/synonymdev/ldk-node/releases/download/\(tag)/LDKNodeFFI.xcframework.zip"
99

1010
let package = Package(

bindgen.sh

100644100755
File mode changed.

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@ android.useAndroidX=true
33
android.enableJetifier=true
44
kotlin.code.style=official
55
group=com.synonym
6-
version=0.7.0-rc.32
6+
version=0.7.0-rc.33
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: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9459,15 +9459,18 @@ object FfiConverterTypeElectrumSyncConfig: FfiConverterRustBuffer<ElectrumSyncCo
94599459
override fun read(buf: ByteBuffer): ElectrumSyncConfig {
94609460
return ElectrumSyncConfig(
94619461
FfiConverterOptionalTypeBackgroundSyncConfig.read(buf),
9462+
FfiConverterULong.read(buf),
94629463
)
94639464
}
94649465

94659466
override fun allocationSize(value: ElectrumSyncConfig) = (
9466-
FfiConverterOptionalTypeBackgroundSyncConfig.allocationSize(value.`backgroundSyncConfig`)
9467+
FfiConverterOptionalTypeBackgroundSyncConfig.allocationSize(value.`backgroundSyncConfig`) +
9468+
FfiConverterULong.allocationSize(value.`connectionTimeoutSecs`)
94679469
)
94689470

94699471
override fun write(value: ElectrumSyncConfig, buf: ByteBuffer) {
94709472
FfiConverterOptionalTypeBackgroundSyncConfig.write(value.`backgroundSyncConfig`, buf)
9473+
FfiConverterULong.write(value.`connectionTimeoutSecs`, buf)
94719474
}
94729475
}
94739476

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -868,7 +868,8 @@ data class CustomTlvRecord (
868868

869869
@kotlinx.serialization.Serializable
870870
data class ElectrumSyncConfig (
871-
val `backgroundSyncConfig`: BackgroundSyncConfig?
871+
val `backgroundSyncConfig`: BackgroundSyncConfig?,
872+
val `connectionTimeoutSecs`: kotlin.ULong
872873
) {
873874
companion object
874875
}

0 commit comments

Comments
 (0)