Skip to content

Commit 5b9fe28

Browse files
committed
feat: add configurable scoring fee/decay parameters
1 parent 224ffe4 commit 5b9fe28

20 files changed

Lines changed: 2156 additions & 948 deletions

File tree

CHANGELOG.md

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

33
## Bug Fixes
44

@@ -65,6 +65,7 @@
6565

6666
## Synonym Fork Additions
6767

68+
- Added configurable routing scorer parameters `scoring_fee_params` and `scoring_decay_params`
6869
- Added `AddressInfo` (`index`, `address`, `keychain`) and `KeychainKind`.
6970
- Added `OnchainPayment` methods `new_address_info`, `new_address_info_for_type`,
7071
`address_info_for_type_at_index`, `address_infos_for_type`, and

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.51"
7+
version = "0.7.0-rc.52"
88
authors = ["Elias Rohrer <dev@tnull.de>"]
99
homepage = "https://lightningdevkit.org/"
1010
license = "MIT OR Apache-2.0"

Package.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
// swift-tools-version:5.5
1+
// swift-tools-version:5.9
22
// The swift-tools-version declares the minimum version of Swift required to build this package.
33

44
import PackageDescription
55

6-
let tag = "v0.7.0-rc.51"
7-
let checksum = "efeec8d0480f1400c6a4203232359f5b3c4c338a4ba13826538cac12b8fe1bac"
6+
let tag = "v0.7.0-rc.52"
7+
let checksum = "bfa1de808ed8b457f6c5aaf911b96806d995fd2a40c04b2b2e27aa75ab206098"
88
let url = "https://github.com/synonymdev/ldk-node/releases/download/\(tag)/LDKNodeFFI.xcframework.zip"
99

1010
let package = Package(

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.51
6+
version=0.7.0-rc.52
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: 186 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1527,6 +1527,10 @@ internal typealias UniffiVTableCallbackInterfaceVssHeaderProviderUniffiByValue =
15271527

15281528

15291529

1530+
1531+
1532+
1533+
15301534

15311535

15321536

@@ -2117,6 +2121,16 @@ internal interface UniffiLib : Library {
21172121
`url`: RustBufferByValue,
21182122
uniffiCallStatus: UniffiRustCallStatus,
21192123
): Unit
2124+
fun uniffi_ldk_node_fn_method_builder_set_scoring_decay_params(
2125+
`ptr`: Pointer?,
2126+
`params`: RustBufferByValue,
2127+
uniffiCallStatus: UniffiRustCallStatus,
2128+
): Unit
2129+
fun uniffi_ldk_node_fn_method_builder_set_scoring_fee_params(
2130+
`ptr`: Pointer?,
2131+
`params`: RustBufferByValue,
2132+
uniffiCallStatus: UniffiRustCallStatus,
2133+
): Unit
21202134
fun uniffi_ldk_node_fn_method_builder_set_storage_dir_path(
21212135
`ptr`: Pointer?,
21222136
`storageDirPath`: RustBufferByValue,
@@ -3218,6 +3232,10 @@ internal interface UniffiLib : Library {
32183232
): Short
32193233
fun uniffi_ldk_node_checksum_method_builder_set_pathfinding_scores_source(
32203234
): Short
3235+
fun uniffi_ldk_node_checksum_method_builder_set_scoring_decay_params(
3236+
): Short
3237+
fun uniffi_ldk_node_checksum_method_builder_set_scoring_fee_params(
3238+
): Short
32213239
fun uniffi_ldk_node_checksum_method_builder_set_storage_dir_path(
32223240
): Short
32233241
fun uniffi_ldk_node_checksum_method_feerate_to_sat_per_kwu(
@@ -3745,6 +3763,12 @@ private fun uniffiCheckApiChecksums(lib: UniffiLib) {
37453763
if (lib.uniffi_ldk_node_checksum_method_builder_set_pathfinding_scores_source() != 63501.toShort()) {
37463764
throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
37473765
}
3766+
if (lib.uniffi_ldk_node_checksum_method_builder_set_scoring_decay_params() != 19869.toShort()) {
3767+
throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
3768+
}
3769+
if (lib.uniffi_ldk_node_checksum_method_builder_set_scoring_fee_params() != 11588.toShort()) {
3770+
throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
3771+
}
37483772
if (lib.uniffi_ldk_node_checksum_method_builder_set_storage_dir_path() != 59019.toShort()) {
37493773
throw RuntimeException("UniFFI API checksum mismatch: try cleaning and rebuilding your project")
37503774
}
@@ -6164,6 +6188,30 @@ open class Builder: Disposable, BuilderInterface {
61646188
}
61656189
}
61666190

6191+
override fun `setScoringDecayParams`(`params`: ScoringDecayParameters) {
6192+
callWithPointer {
6193+
uniffiRustCall { uniffiRustCallStatus ->
6194+
UniffiLib.INSTANCE.uniffi_ldk_node_fn_method_builder_set_scoring_decay_params(
6195+
it,
6196+
FfiConverterTypeScoringDecayParameters.lower(`params`),
6197+
uniffiRustCallStatus,
6198+
)
6199+
}
6200+
}
6201+
}
6202+
6203+
override fun `setScoringFeeParams`(`params`: ScoringFeeParameters) {
6204+
callWithPointer {
6205+
uniffiRustCall { uniffiRustCallStatus ->
6206+
UniffiLib.INSTANCE.uniffi_ldk_node_fn_method_builder_set_scoring_fee_params(
6207+
it,
6208+
FfiConverterTypeScoringFeeParameters.lower(`params`),
6209+
uniffiRustCallStatus,
6210+
)
6211+
}
6212+
}
6213+
}
6214+
61676215
override fun `setStorageDirPath`(`storageDirPath`: kotlin.String) {
61686216
callWithPointer {
61696217
uniffiRustCall { uniffiRustCallStatus ->
@@ -9577,6 +9625,8 @@ object FfiConverterTypeConfig: FfiConverterRustBuffer<Config> {
95779625
FfiConverterULong.read(buf),
95789626
FfiConverterOptionalTypeAnchorChannelsConfig.read(buf),
95799627
FfiConverterOptionalTypeRouteParametersConfig.read(buf),
9628+
FfiConverterOptionalTypeScoringFeeParameters.read(buf),
9629+
FfiConverterOptionalTypeScoringDecayParameters.read(buf),
95809630
FfiConverterBoolean.read(buf),
95819631
FfiConverterTypeAddressType.read(buf),
95829632
FfiConverterSequenceTypeAddressType.read(buf),
@@ -9593,6 +9643,8 @@ object FfiConverterTypeConfig: FfiConverterRustBuffer<Config> {
95939643
FfiConverterULong.allocationSize(value.`probingLiquidityLimitMultiplier`) +
95949644
FfiConverterOptionalTypeAnchorChannelsConfig.allocationSize(value.`anchorChannelsConfig`) +
95959645
FfiConverterOptionalTypeRouteParametersConfig.allocationSize(value.`routeParameters`) +
9646+
FfiConverterOptionalTypeScoringFeeParameters.allocationSize(value.`scoringFeeParams`) +
9647+
FfiConverterOptionalTypeScoringDecayParameters.allocationSize(value.`scoringDecayParams`) +
95969648
FfiConverterBoolean.allocationSize(value.`includeUntrustedPendingInSpendable`) +
95979649
FfiConverterTypeAddressType.allocationSize(value.`addressType`) +
95989650
FfiConverterSequenceTypeAddressType.allocationSize(value.`addressTypesToMonitor`)
@@ -9608,6 +9660,8 @@ object FfiConverterTypeConfig: FfiConverterRustBuffer<Config> {
96089660
FfiConverterULong.write(value.`probingLiquidityLimitMultiplier`, buf)
96099661
FfiConverterOptionalTypeAnchorChannelsConfig.write(value.`anchorChannelsConfig`, buf)
96109662
FfiConverterOptionalTypeRouteParametersConfig.write(value.`routeParameters`, buf)
9663+
FfiConverterOptionalTypeScoringFeeParameters.write(value.`scoringFeeParams`, buf)
9664+
FfiConverterOptionalTypeScoringDecayParameters.write(value.`scoringDecayParams`, buf)
96119665
FfiConverterBoolean.write(value.`includeUntrustedPendingInSpendable`, buf)
96129666
FfiConverterTypeAddressType.write(value.`addressType`, buf)
96139667
FfiConverterSequenceTypeAddressType.write(value.`addressTypesToMonitor`, buf)
@@ -10267,6 +10321,74 @@ object FfiConverterTypeRuntimeSyncIntervals: FfiConverterRustBuffer<RuntimeSyncI
1026710321

1026810322

1026910323

10324+
object FfiConverterTypeScoringDecayParameters: FfiConverterRustBuffer<ScoringDecayParameters> {
10325+
override fun read(buf: ByteBuffer): ScoringDecayParameters {
10326+
return ScoringDecayParameters(
10327+
FfiConverterULong.read(buf),
10328+
FfiConverterULong.read(buf),
10329+
)
10330+
}
10331+
10332+
override fun allocationSize(value: ScoringDecayParameters) = (
10333+
FfiConverterULong.allocationSize(value.`historicalNoUpdatesHalfLifeSecs`) +
10334+
FfiConverterULong.allocationSize(value.`liquidityOffsetHalfLifeSecs`)
10335+
)
10336+
10337+
override fun write(value: ScoringDecayParameters, buf: ByteBuffer) {
10338+
FfiConverterULong.write(value.`historicalNoUpdatesHalfLifeSecs`, buf)
10339+
FfiConverterULong.write(value.`liquidityOffsetHalfLifeSecs`, buf)
10340+
}
10341+
}
10342+
10343+
10344+
10345+
10346+
object FfiConverterTypeScoringFeeParameters: FfiConverterRustBuffer<ScoringFeeParameters> {
10347+
override fun read(buf: ByteBuffer): ScoringFeeParameters {
10348+
return ScoringFeeParameters(
10349+
FfiConverterULong.read(buf),
10350+
FfiConverterULong.read(buf),
10351+
FfiConverterULong.read(buf),
10352+
FfiConverterULong.read(buf),
10353+
FfiConverterULong.read(buf),
10354+
FfiConverterULong.read(buf),
10355+
FfiConverterULong.read(buf),
10356+
FfiConverterULong.read(buf),
10357+
FfiConverterBoolean.read(buf),
10358+
FfiConverterULong.read(buf),
10359+
)
10360+
}
10361+
10362+
override fun allocationSize(value: ScoringFeeParameters) = (
10363+
FfiConverterULong.allocationSize(value.`basePenaltyMsat`) +
10364+
FfiConverterULong.allocationSize(value.`basePenaltyAmountMultiplierMsat`) +
10365+
FfiConverterULong.allocationSize(value.`liquidityPenaltyMultiplierMsat`) +
10366+
FfiConverterULong.allocationSize(value.`liquidityPenaltyAmountMultiplierMsat`) +
10367+
FfiConverterULong.allocationSize(value.`historicalLiquidityPenaltyMultiplierMsat`) +
10368+
FfiConverterULong.allocationSize(value.`historicalLiquidityPenaltyAmountMultiplierMsat`) +
10369+
FfiConverterULong.allocationSize(value.`antiProbingPenaltyMsat`) +
10370+
FfiConverterULong.allocationSize(value.`consideredImpossiblePenaltyMsat`) +
10371+
FfiConverterBoolean.allocationSize(value.`linearSuccessProbability`) +
10372+
FfiConverterULong.allocationSize(value.`probingDiversityPenaltyMsat`)
10373+
)
10374+
10375+
override fun write(value: ScoringFeeParameters, buf: ByteBuffer) {
10376+
FfiConverterULong.write(value.`basePenaltyMsat`, buf)
10377+
FfiConverterULong.write(value.`basePenaltyAmountMultiplierMsat`, buf)
10378+
FfiConverterULong.write(value.`liquidityPenaltyMultiplierMsat`, buf)
10379+
FfiConverterULong.write(value.`liquidityPenaltyAmountMultiplierMsat`, buf)
10380+
FfiConverterULong.write(value.`historicalLiquidityPenaltyMultiplierMsat`, buf)
10381+
FfiConverterULong.write(value.`historicalLiquidityPenaltyAmountMultiplierMsat`, buf)
10382+
FfiConverterULong.write(value.`antiProbingPenaltyMsat`, buf)
10383+
FfiConverterULong.write(value.`consideredImpossiblePenaltyMsat`, buf)
10384+
FfiConverterBoolean.write(value.`linearSuccessProbability`, buf)
10385+
FfiConverterULong.write(value.`probingDiversityPenaltyMsat`, buf)
10386+
}
10387+
}
10388+
10389+
10390+
10391+
1027010392
object FfiConverterTypeSpendableUtxo: FfiConverterRustBuffer<SpendableUtxo> {
1027110393
override fun read(buf: ByteBuffer): SpendableUtxo {
1027210394
return SpendableUtxo(
@@ -10931,11 +11053,13 @@ object FfiConverterTypeEvent : FfiConverterRustBuffer<Event>{
1093111053
6 -> Event.ProbeSuccessful(
1093211054
FfiConverterTypePaymentId.read(buf),
1093311055
FfiConverterTypePaymentHash.read(buf),
11056+
FfiConverterOptionalULong.read(buf),
1093411057
)
1093511058
7 -> Event.ProbeFailed(
1093611059
FfiConverterTypePaymentId.read(buf),
1093711060
FfiConverterTypePaymentHash.read(buf),
1093811061
FfiConverterOptionalULong.read(buf),
11062+
FfiConverterOptionalULong.read(buf),
1093911063
)
1094011064
8 -> Event.ChannelPending(
1094111065
FfiConverterTypeChannelId.read(buf),
@@ -11074,6 +11198,7 @@ object FfiConverterTypeEvent : FfiConverterRustBuffer<Event>{
1107411198
4UL
1107511199
+ FfiConverterTypePaymentId.allocationSize(value.`paymentId`)
1107611200
+ FfiConverterTypePaymentHash.allocationSize(value.`paymentHash`)
11201+
+ FfiConverterOptionalULong.allocationSize(value.`routeFeeMsat`)
1107711202
)
1107811203
}
1107911204
is Event.ProbeFailed -> {
@@ -11083,6 +11208,7 @@ object FfiConverterTypeEvent : FfiConverterRustBuffer<Event>{
1108311208
+ FfiConverterTypePaymentId.allocationSize(value.`paymentId`)
1108411209
+ FfiConverterTypePaymentHash.allocationSize(value.`paymentHash`)
1108511210
+ FfiConverterOptionalULong.allocationSize(value.`shortChannelId`)
11211+
+ FfiConverterOptionalULong.allocationSize(value.`routeFeeMsat`)
1108611212
)
1108711213
}
1108811214
is Event.ChannelPending -> {
@@ -11261,13 +11387,15 @@ object FfiConverterTypeEvent : FfiConverterRustBuffer<Event>{
1126111387
buf.putInt(6)
1126211388
FfiConverterTypePaymentId.write(value.`paymentId`, buf)
1126311389
FfiConverterTypePaymentHash.write(value.`paymentHash`, buf)
11390+
FfiConverterOptionalULong.write(value.`routeFeeMsat`, buf)
1126411391
Unit
1126511392
}
1126611393
is Event.ProbeFailed -> {
1126711394
buf.putInt(7)
1126811395
FfiConverterTypePaymentId.write(value.`paymentId`, buf)
1126911396
FfiConverterTypePaymentHash.write(value.`paymentHash`, buf)
1127011397
FfiConverterOptionalULong.write(value.`shortChannelId`, buf)
11398+
FfiConverterOptionalULong.write(value.`routeFeeMsat`, buf)
1127111399
Unit
1127211400
}
1127311401
is Event.ChannelPending -> {
@@ -13168,6 +13296,64 @@ object FfiConverterOptionalTypeRouteParametersConfig: FfiConverterRustBuffer<Rou
1316813296

1316913297

1317013298

13299+
object FfiConverterOptionalTypeScoringDecayParameters: FfiConverterRustBuffer<ScoringDecayParameters?> {
13300+
override fun read(buf: ByteBuffer): ScoringDecayParameters? {
13301+
if (buf.get().toInt() == 0) {
13302+
return null
13303+
}
13304+
return FfiConverterTypeScoringDecayParameters.read(buf)
13305+
}
13306+
13307+
override fun allocationSize(value: ScoringDecayParameters?): ULong {
13308+
if (value == null) {
13309+
return 1UL
13310+
} else {
13311+
return 1UL + FfiConverterTypeScoringDecayParameters.allocationSize(value)
13312+
}
13313+
}
13314+
13315+
override fun write(value: ScoringDecayParameters?, buf: ByteBuffer) {
13316+
if (value == null) {
13317+
buf.put(0)
13318+
} else {
13319+
buf.put(1)
13320+
FfiConverterTypeScoringDecayParameters.write(value, buf)
13321+
}
13322+
}
13323+
}
13324+
13325+
13326+
13327+
13328+
object FfiConverterOptionalTypeScoringFeeParameters: FfiConverterRustBuffer<ScoringFeeParameters?> {
13329+
override fun read(buf: ByteBuffer): ScoringFeeParameters? {
13330+
if (buf.get().toInt() == 0) {
13331+
return null
13332+
}
13333+
return FfiConverterTypeScoringFeeParameters.read(buf)
13334+
}
13335+
13336+
override fun allocationSize(value: ScoringFeeParameters?): ULong {
13337+
if (value == null) {
13338+
return 1UL
13339+
} else {
13340+
return 1UL + FfiConverterTypeScoringFeeParameters.allocationSize(value)
13341+
}
13342+
}
13343+
13344+
override fun write(value: ScoringFeeParameters?, buf: ByteBuffer) {
13345+
if (value == null) {
13346+
buf.put(0)
13347+
} else {
13348+
buf.put(1)
13349+
FfiConverterTypeScoringFeeParameters.write(value, buf)
13350+
}
13351+
}
13352+
}
13353+
13354+
13355+
13356+
1317113357
object FfiConverterOptionalTypeTransactionDetails: FfiConverterRustBuffer<TransactionDetails?> {
1317213358
override fun read(buf: ByteBuffer): TransactionDetails? {
1317313359
if (buf.get().toInt() == 0) {

0 commit comments

Comments
 (0)