Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,9 @@ swift.swiftdoc
*.a
*.d

# macOS Finder metadata (icon positions, view options)
.DS_Store

# IDE and local files
.idea
.build
Expand Down
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,12 @@

## Synonym Fork Additions

- Added configurable routing scorer parameters:
- New config structs: `ScoringFeeParameters` and `ScoringDecayParameters`
- New `Config` fields: `scoring_fee_params` and `scoring_decay_params` (optional; default to
LDK probabilistic scorer defaults when unset)
- New builder APIs: `set_scoring_fee_params(...)` and `set_scoring_decay_params(...)`
- Exposed via UniFFI/UDL for Swift/Kotlin/Python consumers
- Added `connection_timeout_secs` field to `ElectrumSyncConfig` (default: 10 s). This bounds
Electrum socket operations for both the BDK on-chain and LDK tx-sync clients, preventing Tokio's
blocking thread pool from being exhausted by threads stuck on dead sockets under total packet
Expand Down
2 changes: 1 addition & 1 deletion Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import PackageDescription

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

let package = Package(
Expand Down
9 changes: 9 additions & 0 deletions bindings/kotlin/.editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
root = true

[*.kt]
indent_style = space
indent_size = 4

[*.kts]
indent_style = space
indent_size = 4
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,10 @@ internal typealias UniffiVTableCallbackInterfaceVssHeaderProviderUniffiByValue =










Expand Down Expand Up @@ -2107,6 +2111,16 @@ internal interface UniffiLib : Library {
`url`: RustBufferByValue,
uniffiCallStatus: UniffiRustCallStatus,
): Unit
fun uniffi_ldk_node_fn_method_builder_set_scoring_decay_params(
`ptr`: Pointer?,
`params`: RustBufferByValue,
uniffiCallStatus: UniffiRustCallStatus,
): Unit
fun uniffi_ldk_node_fn_method_builder_set_scoring_fee_params(
`ptr`: Pointer?,
`params`: RustBufferByValue,
uniffiCallStatus: UniffiRustCallStatus,
): Unit
fun uniffi_ldk_node_fn_method_builder_set_storage_dir_path(
`ptr`: Pointer?,
`storageDirPath`: RustBufferByValue,
Expand Down Expand Up @@ -3178,6 +3192,10 @@ internal interface UniffiLib : Library {
): Short
fun uniffi_ldk_node_checksum_method_builder_set_pathfinding_scores_source(
): Short
fun uniffi_ldk_node_checksum_method_builder_set_scoring_decay_params(
): Short
fun uniffi_ldk_node_checksum_method_builder_set_scoring_fee_params(
): Short
fun uniffi_ldk_node_checksum_method_builder_set_storage_dir_path(
): Short
fun uniffi_ldk_node_checksum_method_feerate_to_sat_per_kwu(
Expand Down Expand Up @@ -3695,6 +3713,12 @@ private fun uniffiCheckApiChecksums(lib: UniffiLib) {
if (lib.uniffi_ldk_node_checksum_method_builder_set_pathfinding_scores_source() != 63501.toShort()) {
throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
}
if (lib.uniffi_ldk_node_checksum_method_builder_set_scoring_decay_params() != 19869.toShort()) {
throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
}
if (lib.uniffi_ldk_node_checksum_method_builder_set_scoring_fee_params() != 11588.toShort()) {
throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
}
if (lib.uniffi_ldk_node_checksum_method_builder_set_storage_dir_path() != 59019.toShort()) {
throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
}
Expand Down Expand Up @@ -6099,6 +6123,30 @@ open class Builder: Disposable, BuilderInterface {
}
}

override fun `setScoringDecayParams`(`params`: ScoringDecayParameters) {
callWithPointer {
uniffiRustCall { uniffiRustCallStatus ->
UniffiLib.INSTANCE.uniffi_ldk_node_fn_method_builder_set_scoring_decay_params(
it,
FfiConverterTypeScoringDecayParameters.lower(`params`),
uniffiRustCallStatus,
)
}
}
}

override fun `setScoringFeeParams`(`params`: ScoringFeeParameters) {
callWithPointer {
uniffiRustCall { uniffiRustCallStatus ->
UniffiLib.INSTANCE.uniffi_ldk_node_fn_method_builder_set_scoring_fee_params(
it,
FfiConverterTypeScoringFeeParameters.lower(`params`),
uniffiRustCallStatus,
)
}
}
}

override fun `setStorageDirPath`(`storageDirPath`: kotlin.String) {
callWithPointer {
uniffiRustCall { uniffiRustCallStatus ->
Expand Down Expand Up @@ -9417,6 +9465,8 @@ object FfiConverterTypeConfig: FfiConverterRustBuffer<Config> {
FfiConverterULong.read(buf),
FfiConverterOptionalTypeAnchorChannelsConfig.read(buf),
FfiConverterOptionalTypeRouteParametersConfig.read(buf),
FfiConverterOptionalTypeScoringFeeParameters.read(buf),
FfiConverterOptionalTypeScoringDecayParameters.read(buf),
FfiConverterBoolean.read(buf),
FfiConverterTypeAddressType.read(buf),
FfiConverterSequenceTypeAddressType.read(buf),
Expand All @@ -9433,6 +9483,8 @@ object FfiConverterTypeConfig: FfiConverterRustBuffer<Config> {
FfiConverterULong.allocationSize(value.`probingLiquidityLimitMultiplier`) +
FfiConverterOptionalTypeAnchorChannelsConfig.allocationSize(value.`anchorChannelsConfig`) +
FfiConverterOptionalTypeRouteParametersConfig.allocationSize(value.`routeParameters`) +
FfiConverterOptionalTypeScoringFeeParameters.allocationSize(value.`scoringFeeParams`) +
FfiConverterOptionalTypeScoringDecayParameters.allocationSize(value.`scoringDecayParams`) +
FfiConverterBoolean.allocationSize(value.`includeUntrustedPendingInSpendable`) +
FfiConverterTypeAddressType.allocationSize(value.`addressType`) +
FfiConverterSequenceTypeAddressType.allocationSize(value.`addressTypesToMonitor`)
Expand All @@ -9448,6 +9500,8 @@ object FfiConverterTypeConfig: FfiConverterRustBuffer<Config> {
FfiConverterULong.write(value.`probingLiquidityLimitMultiplier`, buf)
FfiConverterOptionalTypeAnchorChannelsConfig.write(value.`anchorChannelsConfig`, buf)
FfiConverterOptionalTypeRouteParametersConfig.write(value.`routeParameters`, buf)
FfiConverterOptionalTypeScoringFeeParameters.write(value.`scoringFeeParams`, buf)
FfiConverterOptionalTypeScoringDecayParameters.write(value.`scoringDecayParams`, buf)
FfiConverterBoolean.write(value.`includeUntrustedPendingInSpendable`, buf)
FfiConverterTypeAddressType.write(value.`addressType`, buf)
FfiConverterSequenceTypeAddressType.write(value.`addressTypesToMonitor`, buf)
Expand Down Expand Up @@ -10085,6 +10139,74 @@ object FfiConverterTypeRuntimeSyncIntervals: FfiConverterRustBuffer<RuntimeSyncI



object FfiConverterTypeScoringDecayParameters: FfiConverterRustBuffer<ScoringDecayParameters> {
override fun read(buf: ByteBuffer): ScoringDecayParameters {
return ScoringDecayParameters(
FfiConverterULong.read(buf),
FfiConverterULong.read(buf),
)
}

override fun allocationSize(value: ScoringDecayParameters) = (
FfiConverterULong.allocationSize(value.`historicalNoUpdatesHalfLifeSecs`) +
FfiConverterULong.allocationSize(value.`liquidityOffsetHalfLifeSecs`)
)

override fun write(value: ScoringDecayParameters, buf: ByteBuffer) {
FfiConverterULong.write(value.`historicalNoUpdatesHalfLifeSecs`, buf)
FfiConverterULong.write(value.`liquidityOffsetHalfLifeSecs`, buf)
}
}




object FfiConverterTypeScoringFeeParameters: FfiConverterRustBuffer<ScoringFeeParameters> {
override fun read(buf: ByteBuffer): ScoringFeeParameters {
return ScoringFeeParameters(
FfiConverterULong.read(buf),
FfiConverterULong.read(buf),
FfiConverterULong.read(buf),
FfiConverterULong.read(buf),
FfiConverterULong.read(buf),
FfiConverterULong.read(buf),
FfiConverterULong.read(buf),
FfiConverterULong.read(buf),
FfiConverterBoolean.read(buf),
FfiConverterULong.read(buf),
)
}

override fun allocationSize(value: ScoringFeeParameters) = (
FfiConverterULong.allocationSize(value.`basePenaltyMsat`) +
FfiConverterULong.allocationSize(value.`basePenaltyAmountMultiplierMsat`) +
FfiConverterULong.allocationSize(value.`liquidityPenaltyMultiplierMsat`) +
FfiConverterULong.allocationSize(value.`liquidityPenaltyAmountMultiplierMsat`) +
FfiConverterULong.allocationSize(value.`historicalLiquidityPenaltyMultiplierMsat`) +
FfiConverterULong.allocationSize(value.`historicalLiquidityPenaltyAmountMultiplierMsat`) +
FfiConverterULong.allocationSize(value.`antiProbingPenaltyMsat`) +
FfiConverterULong.allocationSize(value.`consideredImpossiblePenaltyMsat`) +
FfiConverterBoolean.allocationSize(value.`linearSuccessProbability`) +
FfiConverterULong.allocationSize(value.`probingDiversityPenaltyMsat`)
)

override fun write(value: ScoringFeeParameters, buf: ByteBuffer) {
FfiConverterULong.write(value.`basePenaltyMsat`, buf)
FfiConverterULong.write(value.`basePenaltyAmountMultiplierMsat`, buf)
FfiConverterULong.write(value.`liquidityPenaltyMultiplierMsat`, buf)
FfiConverterULong.write(value.`liquidityPenaltyAmountMultiplierMsat`, buf)
FfiConverterULong.write(value.`historicalLiquidityPenaltyMultiplierMsat`, buf)
FfiConverterULong.write(value.`historicalLiquidityPenaltyAmountMultiplierMsat`, buf)
FfiConverterULong.write(value.`antiProbingPenaltyMsat`, buf)
FfiConverterULong.write(value.`consideredImpossiblePenaltyMsat`, buf)
FfiConverterBoolean.write(value.`linearSuccessProbability`, buf)
FfiConverterULong.write(value.`probingDiversityPenaltyMsat`, buf)
}
}




object FfiConverterTypeSpendableUtxo: FfiConverterRustBuffer<SpendableUtxo> {
override fun read(buf: ByteBuffer): SpendableUtxo {
return SpendableUtxo(
Expand Down Expand Up @@ -12929,6 +13051,64 @@ object FfiConverterOptionalTypeRouteParametersConfig: FfiConverterRustBuffer<Rou



object FfiConverterOptionalTypeScoringDecayParameters: FfiConverterRustBuffer<ScoringDecayParameters?> {
override fun read(buf: ByteBuffer): ScoringDecayParameters? {
if (buf.get().toInt() == 0) {
return null
}
return FfiConverterTypeScoringDecayParameters.read(buf)
}

override fun allocationSize(value: ScoringDecayParameters?): ULong {
if (value == null) {
return 1UL
} else {
return 1UL + FfiConverterTypeScoringDecayParameters.allocationSize(value)
}
}

override fun write(value: ScoringDecayParameters?, buf: ByteBuffer) {
if (value == null) {
buf.put(0)
} else {
buf.put(1)
FfiConverterTypeScoringDecayParameters.write(value, buf)
}
}
}




object FfiConverterOptionalTypeScoringFeeParameters: FfiConverterRustBuffer<ScoringFeeParameters?> {
override fun read(buf: ByteBuffer): ScoringFeeParameters? {
if (buf.get().toInt() == 0) {
return null
}
return FfiConverterTypeScoringFeeParameters.read(buf)
}

override fun allocationSize(value: ScoringFeeParameters?): ULong {
if (value == null) {
return 1UL
} else {
return 1UL + FfiConverterTypeScoringFeeParameters.allocationSize(value)
}
}

override fun write(value: ScoringFeeParameters?, buf: ByteBuffer) {
if (value == null) {
buf.put(0)
} else {
buf.put(1)
FfiConverterTypeScoringFeeParameters.write(value, buf)
}
}
}




object FfiConverterOptionalTypeTransactionDetails: FfiConverterRustBuffer<TransactionDetails?> {
override fun read(buf: ByteBuffer): TransactionDetails? {
if (buf.get().toInt() == 0) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -352,6 +352,10 @@ interface BuilderInterface {

fun `setPathfindingScoresSource`(`url`: kotlin.String)

fun `setScoringDecayParams`(`params`: ScoringDecayParameters)

fun `setScoringFeeParams`(`params`: ScoringFeeParameters)

fun `setStorageDirPath`(`storageDirPath`: kotlin.String)

companion object
Expand Down Expand Up @@ -849,6 +853,8 @@ data class Config (
val `probingLiquidityLimitMultiplier`: kotlin.ULong,
val `anchorChannelsConfig`: AnchorChannelsConfig?,
val `routeParameters`: RouteParametersConfig?,
val `scoringFeeParams`: ScoringFeeParameters?,
val `scoringDecayParams`: ScoringDecayParameters?,
val `includeUntrustedPendingInSpendable`: kotlin.Boolean,
val `addressType`: AddressType,
val `addressTypesToMonitor`: List<AddressType>
Expand Down Expand Up @@ -1161,6 +1167,34 @@ data class RuntimeSyncIntervals (



@kotlinx.serialization.Serializable
data class ScoringDecayParameters (
val `historicalNoUpdatesHalfLifeSecs`: kotlin.ULong,
val `liquidityOffsetHalfLifeSecs`: kotlin.ULong
) {
companion object
}



@kotlinx.serialization.Serializable
data class ScoringFeeParameters (
val `basePenaltyMsat`: kotlin.ULong,
val `basePenaltyAmountMultiplierMsat`: kotlin.ULong,
val `liquidityPenaltyMultiplierMsat`: kotlin.ULong,
val `liquidityPenaltyAmountMultiplierMsat`: kotlin.ULong,
val `historicalLiquidityPenaltyMultiplierMsat`: kotlin.ULong,
val `historicalLiquidityPenaltyAmountMultiplierMsat`: kotlin.ULong,
val `antiProbingPenaltyMsat`: kotlin.ULong,
val `consideredImpossiblePenaltyMsat`: kotlin.ULong,
val `linearSuccessProbability`: kotlin.Boolean,
val `probingDiversityPenaltyMsat`: kotlin.ULong
) {
companion object
}



@kotlinx.serialization.Serializable
data class SpendableUtxo (
val `outpoint`: OutPoint,
Expand Down Expand Up @@ -2245,6 +2279,10 @@ enum class WordCount {










Expand Down
Loading
Loading