Skip to content

Commit 2a80f37

Browse files
authored
Merge pull request #23 from synonymdev/feat/include-untrusted-pending-in-spendable
feat: allow including received unconfirmed balance in spendable balance
2 parents 201962d + 0b1e2cf commit 2a80f37

File tree

12 files changed

+54
-8
lines changed

12 files changed

+54
-8
lines changed

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,12 @@
4545
- `Bolt11Payment::estimate_routing_fees_using_amount()`: Estimates fees for amount-less invoices.
4646
- Enhanced `OnchainPayment::send_to_address()` to accept optional `utxos_to_spend` parameter
4747
for manual UTXO selection.
48+
- Added `Config::include_untrusted_pending_in_spendable` option to control whether unconfirmed
49+
funds from external sources are included in `spendable_onchain_balance_sats`. When set to `true`,
50+
the spendable balance will include `untrusted_pending` UTXOs (unconfirmed transactions received
51+
from external wallets). Default is `false` for safety, as spending unconfirmed external funds
52+
carries risk of double-spending. This affects all balance reporting including `list_balances()`
53+
and `BalanceChanged` events.
4854

4955
# 0.7.0 - Dec. 3, 2025
5056
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.

Package.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
import PackageDescription
55

66
let tag = "v0.7.0"
7-
let checksum = "688ba4f800921fe64f12b1c457c1765c0868cbb906583918d5933e4f01ba983c"
7+
let checksum = "26c09b6902c07dc1b725871fafb94ab8cf5c31bf08b88322b818a192b0d3cd07"
88
let url = "https://github.com/synonymdev/ldk-node/releases/download/\(tag)/LDKNodeFFI.xcframework.zip"
99

1010
let package = Package(
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
@@ -9112,6 +9112,7 @@ object FfiConverterTypeConfig: FfiConverterRustBuffer<Config> {
91129112
FfiConverterULong.read(buf),
91139113
FfiConverterOptionalTypeAnchorChannelsConfig.read(buf),
91149114
FfiConverterOptionalTypeRouteParametersConfig.read(buf),
9115+
FfiConverterBoolean.read(buf),
91159116
)
91169117
}
91179118

@@ -9124,7 +9125,8 @@ object FfiConverterTypeConfig: FfiConverterRustBuffer<Config> {
91249125
FfiConverterSequenceTypePublicKey.allocationSize(value.`trustedPeers0conf`) +
91259126
FfiConverterULong.allocationSize(value.`probingLiquidityLimitMultiplier`) +
91269127
FfiConverterOptionalTypeAnchorChannelsConfig.allocationSize(value.`anchorChannelsConfig`) +
9127-
FfiConverterOptionalTypeRouteParametersConfig.allocationSize(value.`routeParameters`)
9128+
FfiConverterOptionalTypeRouteParametersConfig.allocationSize(value.`routeParameters`) +
9129+
FfiConverterBoolean.allocationSize(value.`includeUntrustedPendingInSpendable`)
91289130
)
91299131

91309132
override fun write(value: Config, buf: ByteBuffer) {
@@ -9137,6 +9139,7 @@ object FfiConverterTypeConfig: FfiConverterRustBuffer<Config> {
91379139
FfiConverterULong.write(value.`probingLiquidityLimitMultiplier`, buf)
91389140
FfiConverterOptionalTypeAnchorChannelsConfig.write(value.`anchorChannelsConfig`, buf)
91399141
FfiConverterOptionalTypeRouteParametersConfig.write(value.`routeParameters`, buf)
9142+
FfiConverterBoolean.write(value.`includeUntrustedPendingInSpendable`, buf)
91409143
}
91419144
}
91429145

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
@@ -789,7 +789,8 @@ data class Config (
789789
val `trustedPeers0conf`: List<PublicKey>,
790790
val `probingLiquidityLimitMultiplier`: kotlin.ULong,
791791
val `anchorChannelsConfig`: AnchorChannelsConfig?,
792-
val `routeParameters`: RouteParametersConfig?
792+
val `routeParameters`: RouteParametersConfig?,
793+
val `includeUntrustedPendingInSpendable`: kotlin.Boolean
793794
) {
794795
companion object
795796
}

bindings/ldk_node.udl

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ dictionary Config {
1313
u64 probing_liquidity_limit_multiplier;
1414
AnchorChannelsConfig? anchor_channels_config;
1515
RouteParametersConfig? route_parameters;
16+
boolean include_untrusted_pending_in_spendable;
1617
};
1718

1819
dictionary AnchorChannelsConfig {

bindings/python/src/ldk_node/ldk_node.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7683,7 +7683,8 @@ class Config:
76837683
probing_liquidity_limit_multiplier: "int"
76847684
anchor_channels_config: "typing.Optional[AnchorChannelsConfig]"
76857685
route_parameters: "typing.Optional[RouteParametersConfig]"
7686-
def __init__(self, *, storage_dir_path: "str", network: "Network", listening_addresses: "typing.Optional[typing.List[SocketAddress]]", announcement_addresses: "typing.Optional[typing.List[SocketAddress]]", node_alias: "typing.Optional[NodeAlias]", trusted_peers_0conf: "typing.List[PublicKey]", probing_liquidity_limit_multiplier: "int", anchor_channels_config: "typing.Optional[AnchorChannelsConfig]", route_parameters: "typing.Optional[RouteParametersConfig]"):
7686+
include_untrusted_pending_in_spendable: "bool"
7687+
def __init__(self, *, storage_dir_path: "str", network: "Network", listening_addresses: "typing.Optional[typing.List[SocketAddress]]", announcement_addresses: "typing.Optional[typing.List[SocketAddress]]", node_alias: "typing.Optional[NodeAlias]", trusted_peers_0conf: "typing.List[PublicKey]", probing_liquidity_limit_multiplier: "int", anchor_channels_config: "typing.Optional[AnchorChannelsConfig]", route_parameters: "typing.Optional[RouteParametersConfig]", include_untrusted_pending_in_spendable: "bool"):
76877688
self.storage_dir_path = storage_dir_path
76887689
self.network = network
76897690
self.listening_addresses = listening_addresses
@@ -7693,9 +7694,10 @@ def __init__(self, *, storage_dir_path: "str", network: "Network", listening_add
76937694
self.probing_liquidity_limit_multiplier = probing_liquidity_limit_multiplier
76947695
self.anchor_channels_config = anchor_channels_config
76957696
self.route_parameters = route_parameters
7697+
self.include_untrusted_pending_in_spendable = include_untrusted_pending_in_spendable
76967698

76977699
def __str__(self):
7698-
return "Config(storage_dir_path={}, network={}, listening_addresses={}, announcement_addresses={}, node_alias={}, trusted_peers_0conf={}, probing_liquidity_limit_multiplier={}, anchor_channels_config={}, route_parameters={})".format(self.storage_dir_path, self.network, self.listening_addresses, self.announcement_addresses, self.node_alias, self.trusted_peers_0conf, self.probing_liquidity_limit_multiplier, self.anchor_channels_config, self.route_parameters)
7700+
return "Config(storage_dir_path={}, network={}, listening_addresses={}, announcement_addresses={}, node_alias={}, trusted_peers_0conf={}, probing_liquidity_limit_multiplier={}, anchor_channels_config={}, route_parameters={}, include_untrusted_pending_in_spendable={})".format(self.storage_dir_path, self.network, self.listening_addresses, self.announcement_addresses, self.node_alias, self.trusted_peers_0conf, self.probing_liquidity_limit_multiplier, self.anchor_channels_config, self.route_parameters, self.include_untrusted_pending_in_spendable)
76997701

77007702
def __eq__(self, other):
77017703
if self.storage_dir_path != other.storage_dir_path:
@@ -7716,6 +7718,8 @@ def __eq__(self, other):
77167718
return False
77177719
if self.route_parameters != other.route_parameters:
77187720
return False
7721+
if self.include_untrusted_pending_in_spendable != other.include_untrusted_pending_in_spendable:
7722+
return False
77197723
return True
77207724

77217725
class _UniffiConverterTypeConfig(_UniffiConverterRustBuffer):
@@ -7731,6 +7735,7 @@ def read(buf):
77317735
probing_liquidity_limit_multiplier=_UniffiConverterUInt64.read(buf),
77327736
anchor_channels_config=_UniffiConverterOptionalTypeAnchorChannelsConfig.read(buf),
77337737
route_parameters=_UniffiConverterOptionalTypeRouteParametersConfig.read(buf),
7738+
include_untrusted_pending_in_spendable=_UniffiConverterBool.read(buf),
77347739
)
77357740

77367741
@staticmethod
@@ -7744,6 +7749,7 @@ def check_lower(value):
77447749
_UniffiConverterUInt64.check_lower(value.probing_liquidity_limit_multiplier)
77457750
_UniffiConverterOptionalTypeAnchorChannelsConfig.check_lower(value.anchor_channels_config)
77467751
_UniffiConverterOptionalTypeRouteParametersConfig.check_lower(value.route_parameters)
7752+
_UniffiConverterBool.check_lower(value.include_untrusted_pending_in_spendable)
77477753

77487754
@staticmethod
77497755
def write(value, buf):
@@ -7756,6 +7762,7 @@ def write(value, buf):
77567762
_UniffiConverterUInt64.write(value.probing_liquidity_limit_multiplier, buf)
77577763
_UniffiConverterOptionalTypeAnchorChannelsConfig.write(value.anchor_channels_config, buf)
77587764
_UniffiConverterOptionalTypeRouteParametersConfig.write(value.route_parameters, buf)
7765+
_UniffiConverterBool.write(value.include_untrusted_pending_in_spendable, buf)
77597766

77607767

77617768
class CustomTlvRecord:

bindings/swift/Sources/LDKNode/LDKNode.swift

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4901,10 +4901,11 @@ public struct Config {
49014901
public var probingLiquidityLimitMultiplier: UInt64
49024902
public var anchorChannelsConfig: AnchorChannelsConfig?
49034903
public var routeParameters: RouteParametersConfig?
4904+
public var includeUntrustedPendingInSpendable: Bool
49044905

49054906
// Default memberwise initializers are never public by default, so we
49064907
// declare one manually.
4907-
public init(storageDirPath: String, network: Network, listeningAddresses: [SocketAddress]?, announcementAddresses: [SocketAddress]?, nodeAlias: NodeAlias?, trustedPeers0conf: [PublicKey], probingLiquidityLimitMultiplier: UInt64, anchorChannelsConfig: AnchorChannelsConfig?, routeParameters: RouteParametersConfig?) {
4908+
public init(storageDirPath: String, network: Network, listeningAddresses: [SocketAddress]?, announcementAddresses: [SocketAddress]?, nodeAlias: NodeAlias?, trustedPeers0conf: [PublicKey], probingLiquidityLimitMultiplier: UInt64, anchorChannelsConfig: AnchorChannelsConfig?, routeParameters: RouteParametersConfig?, includeUntrustedPendingInSpendable: Bool) {
49084909
self.storageDirPath = storageDirPath
49094910
self.network = network
49104911
self.listeningAddresses = listeningAddresses
@@ -4914,6 +4915,7 @@ public struct Config {
49144915
self.probingLiquidityLimitMultiplier = probingLiquidityLimitMultiplier
49154916
self.anchorChannelsConfig = anchorChannelsConfig
49164917
self.routeParameters = routeParameters
4918+
self.includeUntrustedPendingInSpendable = includeUntrustedPendingInSpendable
49174919
}
49184920
}
49194921

@@ -4946,6 +4948,9 @@ extension Config: Equatable, Hashable {
49464948
if lhs.routeParameters != rhs.routeParameters {
49474949
return false
49484950
}
4951+
if lhs.includeUntrustedPendingInSpendable != rhs.includeUntrustedPendingInSpendable {
4952+
return false
4953+
}
49494954
return true
49504955
}
49514956

@@ -4959,6 +4964,7 @@ extension Config: Equatable, Hashable {
49594964
hasher.combine(probingLiquidityLimitMultiplier)
49604965
hasher.combine(anchorChannelsConfig)
49614966
hasher.combine(routeParameters)
4967+
hasher.combine(includeUntrustedPendingInSpendable)
49624968
}
49634969
}
49644970

@@ -4977,7 +4983,8 @@ public struct FfiConverterTypeConfig: FfiConverterRustBuffer {
49774983
trustedPeers0conf: FfiConverterSequenceTypePublicKey.read(from: &buf),
49784984
probingLiquidityLimitMultiplier: FfiConverterUInt64.read(from: &buf),
49794985
anchorChannelsConfig: FfiConverterOptionTypeAnchorChannelsConfig.read(from: &buf),
4980-
routeParameters: FfiConverterOptionTypeRouteParametersConfig.read(from: &buf)
4986+
routeParameters: FfiConverterOptionTypeRouteParametersConfig.read(from: &buf),
4987+
includeUntrustedPendingInSpendable: FfiConverterBool.read(from: &buf)
49814988
)
49824989
}
49834990

@@ -4991,6 +4998,7 @@ public struct FfiConverterTypeConfig: FfiConverterRustBuffer {
49914998
FfiConverterUInt64.write(value.probingLiquidityLimitMultiplier, into: &buf)
49924999
FfiConverterOptionTypeAnchorChannelsConfig.write(value.anchorChannelsConfig, into: &buf)
49935000
FfiConverterOptionTypeRouteParametersConfig.write(value.routeParameters, into: &buf)
5001+
FfiConverterBool.write(value.includeUntrustedPendingInSpendable, into: &buf)
49945002
}
49955003
}
49965004

0 commit comments

Comments
 (0)