From 46260dc0323d46863f7fe157af6cd3e7cea714ad Mon Sep 17 00:00:00 2001 From: amackillop Date: Fri, 8 May 2026 12:15:08 -0700 Subject: [PATCH 1/3] Bump ldk-node to 5dce44b Move from lsp-0.7.0_socks-support (c3aba2a) to lsp-0.7.0_accept-underpaying-htlcs_with_timing_logs (5dce44b). The two branches share a merge base at 4309f47 (disconnect-all-peers). Above that, the old tip carried one SOCKS commit. The new tip carries five: e935695 Upgrade rust-lightning 5baa1f8 Allow setting custom scoring parameters 522b511 Add SOCKS5 proxy support (rebased equivalent of c3aba2a) 8d956d7 Expose channel_funding_fee_sats_per_kwu on Node 5dce44b Add Node::get_max_splice_in_amount accessor So vs the old rev we pick up a rust-lightning bump, tunable ProbabilisticScorer parameters, a channel funding fee accessor, and a splice-in amount accessor. The dev-only ldk-node-lsp pin is unrelated and unchanged. --- Cargo.lock | 154 ++++++++++++++++++++++++++--------------------------- Cargo.toml | 4 +- 2 files changed, 79 insertions(+), 79 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index a08a385..e77b22c 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1395,7 +1395,7 @@ checksum = "bbd2bcb4c963f2ddae06a2efc7e9f3591312473c50c6685e1f298068316e66fe" [[package]] name = "ldk-node" version = "0.7.0" -source = "git+https://github.com/moneydevkit/ldk-node?rev=c3aba2a47a6314968979de8fe772d9d1bcb3ee6e#c3aba2a47a6314968979de8fe772d9d1bcb3ee6e" +source = "git+https://github.com/moneydevkit/ldk-node?rev=5dce44b6e795560bbf62f49d3648308ce88a0586#5dce44b6e795560bbf62f49d3648308ce88a0586" dependencies = [ "base64 0.22.1", "bdk_chain", @@ -1410,17 +1410,17 @@ dependencies = [ "electrum-client", "esplora-client", "libc", - "lightning 0.2.0 (git+https://github.com/moneydevkit/rust-lightning?rev=adf445e5d5e5c9f0f3c0e3925989404707e06e3f)", - "lightning-background-processor 0.2.0 (git+https://github.com/moneydevkit/rust-lightning?rev=adf445e5d5e5c9f0f3c0e3925989404707e06e3f)", - "lightning-block-sync 0.2.0 (git+https://github.com/moneydevkit/rust-lightning?rev=adf445e5d5e5c9f0f3c0e3925989404707e06e3f)", - "lightning-invoice 0.34.0 (git+https://github.com/moneydevkit/rust-lightning?rev=adf445e5d5e5c9f0f3c0e3925989404707e06e3f)", - "lightning-liquidity 0.2.0 (git+https://github.com/moneydevkit/rust-lightning?rev=adf445e5d5e5c9f0f3c0e3925989404707e06e3f)", - "lightning-macros 0.2.0 (git+https://github.com/moneydevkit/rust-lightning?rev=adf445e5d5e5c9f0f3c0e3925989404707e06e3f)", - "lightning-net-tokio 0.2.0 (git+https://github.com/moneydevkit/rust-lightning?rev=adf445e5d5e5c9f0f3c0e3925989404707e06e3f)", - "lightning-persister 0.2.0 (git+https://github.com/moneydevkit/rust-lightning?rev=adf445e5d5e5c9f0f3c0e3925989404707e06e3f)", - "lightning-rapid-gossip-sync 0.2.0 (git+https://github.com/moneydevkit/rust-lightning?rev=adf445e5d5e5c9f0f3c0e3925989404707e06e3f)", - "lightning-transaction-sync 0.2.0 (git+https://github.com/moneydevkit/rust-lightning?rev=adf445e5d5e5c9f0f3c0e3925989404707e06e3f)", - "lightning-types 0.3.0 (git+https://github.com/moneydevkit/rust-lightning?rev=adf445e5d5e5c9f0f3c0e3925989404707e06e3f)", + "lightning 0.2.0 (git+https://github.com/moneydevkit/rust-lightning?rev=f56f47fe6c874771cd079faaacf96c42b32fbe72)", + "lightning-background-processor 0.2.0 (git+https://github.com/moneydevkit/rust-lightning?rev=f56f47fe6c874771cd079faaacf96c42b32fbe72)", + "lightning-block-sync 0.2.0 (git+https://github.com/moneydevkit/rust-lightning?rev=f56f47fe6c874771cd079faaacf96c42b32fbe72)", + "lightning-invoice 0.34.0 (git+https://github.com/moneydevkit/rust-lightning?rev=f56f47fe6c874771cd079faaacf96c42b32fbe72)", + "lightning-liquidity 0.2.0 (git+https://github.com/moneydevkit/rust-lightning?rev=f56f47fe6c874771cd079faaacf96c42b32fbe72)", + "lightning-macros 0.2.0 (git+https://github.com/moneydevkit/rust-lightning?rev=f56f47fe6c874771cd079faaacf96c42b32fbe72)", + "lightning-net-tokio 0.2.0 (git+https://github.com/moneydevkit/rust-lightning?rev=f56f47fe6c874771cd079faaacf96c42b32fbe72)", + "lightning-persister 0.2.0 (git+https://github.com/moneydevkit/rust-lightning?rev=f56f47fe6c874771cd079faaacf96c42b32fbe72)", + "lightning-rapid-gossip-sync 0.2.0 (git+https://github.com/moneydevkit/rust-lightning?rev=f56f47fe6c874771cd079faaacf96c42b32fbe72)", + "lightning-transaction-sync 0.2.0 (git+https://github.com/moneydevkit/rust-lightning?rev=f56f47fe6c874771cd079faaacf96c42b32fbe72)", + "lightning-types 0.3.0 (git+https://github.com/moneydevkit/rust-lightning?rev=f56f47fe6c874771cd079faaacf96c42b32fbe72)", "log", "prost", "rand 0.9.2", @@ -1508,35 +1508,35 @@ dependencies = [ [[package]] name = "lightning" version = "0.2.0" -source = "git+https://github.com/moneydevkit/rust-lightning?rev=adf445e5d5e5c9f0f3c0e3925989404707e06e3f#adf445e5d5e5c9f0f3c0e3925989404707e06e3f" +source = "git+https://github.com/moneydevkit/rust-lightning?rev=eecf53e7c763e8ae8e436585858db506a7aac588#eecf53e7c763e8ae8e436585858db506a7aac588" dependencies = [ "bech32", "bitcoin", "dnssec-prover", "hashbrown 0.13.2", "libm", - "lightning-invoice 0.34.0 (git+https://github.com/moneydevkit/rust-lightning?rev=adf445e5d5e5c9f0f3c0e3925989404707e06e3f)", - "lightning-macros 0.2.0 (git+https://github.com/moneydevkit/rust-lightning?rev=adf445e5d5e5c9f0f3c0e3925989404707e06e3f)", - "lightning-types 0.3.0 (git+https://github.com/moneydevkit/rust-lightning?rev=adf445e5d5e5c9f0f3c0e3925989404707e06e3f)", + "lightning-invoice 0.34.0 (git+https://github.com/moneydevkit/rust-lightning?rev=eecf53e7c763e8ae8e436585858db506a7aac588)", + "lightning-macros 0.2.0 (git+https://github.com/moneydevkit/rust-lightning?rev=eecf53e7c763e8ae8e436585858db506a7aac588)", + "lightning-types 0.3.0 (git+https://github.com/moneydevkit/rust-lightning?rev=eecf53e7c763e8ae8e436585858db506a7aac588)", "musig2", - "possiblyrandom 0.2.0 (git+https://github.com/moneydevkit/rust-lightning?rev=adf445e5d5e5c9f0f3c0e3925989404707e06e3f)", + "possiblyrandom 0.2.0 (git+https://github.com/moneydevkit/rust-lightning?rev=eecf53e7c763e8ae8e436585858db506a7aac588)", ] [[package]] name = "lightning" version = "0.2.0" -source = "git+https://github.com/moneydevkit/rust-lightning?rev=eecf53e7c763e8ae8e436585858db506a7aac588#eecf53e7c763e8ae8e436585858db506a7aac588" +source = "git+https://github.com/moneydevkit/rust-lightning?rev=f56f47fe6c874771cd079faaacf96c42b32fbe72#f56f47fe6c874771cd079faaacf96c42b32fbe72" dependencies = [ "bech32", "bitcoin", "dnssec-prover", "hashbrown 0.13.2", "libm", - "lightning-invoice 0.34.0 (git+https://github.com/moneydevkit/rust-lightning?rev=eecf53e7c763e8ae8e436585858db506a7aac588)", - "lightning-macros 0.2.0 (git+https://github.com/moneydevkit/rust-lightning?rev=eecf53e7c763e8ae8e436585858db506a7aac588)", - "lightning-types 0.3.0 (git+https://github.com/moneydevkit/rust-lightning?rev=eecf53e7c763e8ae8e436585858db506a7aac588)", + "lightning-invoice 0.34.0 (git+https://github.com/moneydevkit/rust-lightning?rev=f56f47fe6c874771cd079faaacf96c42b32fbe72)", + "lightning-macros 0.2.0 (git+https://github.com/moneydevkit/rust-lightning?rev=f56f47fe6c874771cd079faaacf96c42b32fbe72)", + "lightning-types 0.3.0 (git+https://github.com/moneydevkit/rust-lightning?rev=f56f47fe6c874771cd079faaacf96c42b32fbe72)", "musig2", - "possiblyrandom 0.2.0 (git+https://github.com/moneydevkit/rust-lightning?rev=eecf53e7c763e8ae8e436585858db506a7aac588)", + "possiblyrandom 0.2.0 (git+https://github.com/moneydevkit/rust-lightning?rev=f56f47fe6c874771cd079faaacf96c42b32fbe72)", ] [[package]] @@ -1559,39 +1559,39 @@ dependencies = [ [[package]] name = "lightning-background-processor" version = "0.2.0" -source = "git+https://github.com/moneydevkit/rust-lightning?rev=adf445e5d5e5c9f0f3c0e3925989404707e06e3f#adf445e5d5e5c9f0f3c0e3925989404707e06e3f" +source = "git+https://github.com/moneydevkit/rust-lightning?rev=eecf53e7c763e8ae8e436585858db506a7aac588#eecf53e7c763e8ae8e436585858db506a7aac588" dependencies = [ "bitcoin", "bitcoin-io", "bitcoin_hashes", - "lightning 0.2.0 (git+https://github.com/moneydevkit/rust-lightning?rev=adf445e5d5e5c9f0f3c0e3925989404707e06e3f)", - "lightning-liquidity 0.2.0 (git+https://github.com/moneydevkit/rust-lightning?rev=adf445e5d5e5c9f0f3c0e3925989404707e06e3f)", - "lightning-rapid-gossip-sync 0.2.0 (git+https://github.com/moneydevkit/rust-lightning?rev=adf445e5d5e5c9f0f3c0e3925989404707e06e3f)", - "possiblyrandom 0.2.0 (git+https://github.com/moneydevkit/rust-lightning?rev=adf445e5d5e5c9f0f3c0e3925989404707e06e3f)", + "lightning 0.2.0 (git+https://github.com/moneydevkit/rust-lightning?rev=eecf53e7c763e8ae8e436585858db506a7aac588)", + "lightning-liquidity 0.2.0 (git+https://github.com/moneydevkit/rust-lightning?rev=eecf53e7c763e8ae8e436585858db506a7aac588)", + "lightning-rapid-gossip-sync 0.2.0 (git+https://github.com/moneydevkit/rust-lightning?rev=eecf53e7c763e8ae8e436585858db506a7aac588)", + "possiblyrandom 0.2.0 (git+https://github.com/moneydevkit/rust-lightning?rev=eecf53e7c763e8ae8e436585858db506a7aac588)", ] [[package]] name = "lightning-background-processor" version = "0.2.0" -source = "git+https://github.com/moneydevkit/rust-lightning?rev=eecf53e7c763e8ae8e436585858db506a7aac588#eecf53e7c763e8ae8e436585858db506a7aac588" +source = "git+https://github.com/moneydevkit/rust-lightning?rev=f56f47fe6c874771cd079faaacf96c42b32fbe72#f56f47fe6c874771cd079faaacf96c42b32fbe72" dependencies = [ "bitcoin", "bitcoin-io", "bitcoin_hashes", - "lightning 0.2.0 (git+https://github.com/moneydevkit/rust-lightning?rev=eecf53e7c763e8ae8e436585858db506a7aac588)", - "lightning-liquidity 0.2.0 (git+https://github.com/moneydevkit/rust-lightning?rev=eecf53e7c763e8ae8e436585858db506a7aac588)", - "lightning-rapid-gossip-sync 0.2.0 (git+https://github.com/moneydevkit/rust-lightning?rev=eecf53e7c763e8ae8e436585858db506a7aac588)", - "possiblyrandom 0.2.0 (git+https://github.com/moneydevkit/rust-lightning?rev=eecf53e7c763e8ae8e436585858db506a7aac588)", + "lightning 0.2.0 (git+https://github.com/moneydevkit/rust-lightning?rev=f56f47fe6c874771cd079faaacf96c42b32fbe72)", + "lightning-liquidity 0.2.0 (git+https://github.com/moneydevkit/rust-lightning?rev=f56f47fe6c874771cd079faaacf96c42b32fbe72)", + "lightning-rapid-gossip-sync 0.2.0 (git+https://github.com/moneydevkit/rust-lightning?rev=f56f47fe6c874771cd079faaacf96c42b32fbe72)", + "possiblyrandom 0.2.0 (git+https://github.com/moneydevkit/rust-lightning?rev=f56f47fe6c874771cd079faaacf96c42b32fbe72)", ] [[package]] name = "lightning-block-sync" version = "0.2.0" -source = "git+https://github.com/moneydevkit/rust-lightning?rev=adf445e5d5e5c9f0f3c0e3925989404707e06e3f#adf445e5d5e5c9f0f3c0e3925989404707e06e3f" +source = "git+https://github.com/moneydevkit/rust-lightning?rev=eecf53e7c763e8ae8e436585858db506a7aac588#eecf53e7c763e8ae8e436585858db506a7aac588" dependencies = [ "bitcoin", "chunked_transfer", - "lightning 0.2.0 (git+https://github.com/moneydevkit/rust-lightning?rev=adf445e5d5e5c9f0f3c0e3925989404707e06e3f)", + "lightning 0.2.0 (git+https://github.com/moneydevkit/rust-lightning?rev=eecf53e7c763e8ae8e436585858db506a7aac588)", "serde_json", "tokio", ] @@ -1599,11 +1599,11 @@ dependencies = [ [[package]] name = "lightning-block-sync" version = "0.2.0" -source = "git+https://github.com/moneydevkit/rust-lightning?rev=eecf53e7c763e8ae8e436585858db506a7aac588#eecf53e7c763e8ae8e436585858db506a7aac588" +source = "git+https://github.com/moneydevkit/rust-lightning?rev=f56f47fe6c874771cd079faaacf96c42b32fbe72#f56f47fe6c874771cd079faaacf96c42b32fbe72" dependencies = [ "bitcoin", "chunked_transfer", - "lightning 0.2.0 (git+https://github.com/moneydevkit/rust-lightning?rev=eecf53e7c763e8ae8e436585858db506a7aac588)", + "lightning 0.2.0 (git+https://github.com/moneydevkit/rust-lightning?rev=f56f47fe6c874771cd079faaacf96c42b32fbe72)", "serde_json", "tokio", ] @@ -1611,22 +1611,22 @@ dependencies = [ [[package]] name = "lightning-invoice" version = "0.34.0" -source = "git+https://github.com/moneydevkit/rust-lightning?rev=adf445e5d5e5c9f0f3c0e3925989404707e06e3f#adf445e5d5e5c9f0f3c0e3925989404707e06e3f" +source = "git+https://github.com/moneydevkit/rust-lightning?rev=eecf53e7c763e8ae8e436585858db506a7aac588#eecf53e7c763e8ae8e436585858db506a7aac588" dependencies = [ "bech32", "bitcoin", - "lightning-types 0.3.0 (git+https://github.com/moneydevkit/rust-lightning?rev=adf445e5d5e5c9f0f3c0e3925989404707e06e3f)", + "lightning-types 0.3.0 (git+https://github.com/moneydevkit/rust-lightning?rev=eecf53e7c763e8ae8e436585858db506a7aac588)", "serde", ] [[package]] name = "lightning-invoice" version = "0.34.0" -source = "git+https://github.com/moneydevkit/rust-lightning?rev=eecf53e7c763e8ae8e436585858db506a7aac588#eecf53e7c763e8ae8e436585858db506a7aac588" +source = "git+https://github.com/moneydevkit/rust-lightning?rev=f56f47fe6c874771cd079faaacf96c42b32fbe72#f56f47fe6c874771cd079faaacf96c42b32fbe72" dependencies = [ "bech32", "bitcoin", - "lightning-types 0.3.0 (git+https://github.com/moneydevkit/rust-lightning?rev=eecf53e7c763e8ae8e436585858db506a7aac588)", + "lightning-types 0.3.0 (git+https://github.com/moneydevkit/rust-lightning?rev=f56f47fe6c874771cd079faaacf96c42b32fbe72)", "serde", ] @@ -1643,14 +1643,14 @@ dependencies = [ [[package]] name = "lightning-liquidity" version = "0.2.0" -source = "git+https://github.com/moneydevkit/rust-lightning?rev=adf445e5d5e5c9f0f3c0e3925989404707e06e3f#adf445e5d5e5c9f0f3c0e3925989404707e06e3f" +source = "git+https://github.com/moneydevkit/rust-lightning?rev=eecf53e7c763e8ae8e436585858db506a7aac588#eecf53e7c763e8ae8e436585858db506a7aac588" dependencies = [ "bitcoin", "chrono", - "lightning 0.2.0 (git+https://github.com/moneydevkit/rust-lightning?rev=adf445e5d5e5c9f0f3c0e3925989404707e06e3f)", - "lightning-invoice 0.34.0 (git+https://github.com/moneydevkit/rust-lightning?rev=adf445e5d5e5c9f0f3c0e3925989404707e06e3f)", - "lightning-macros 0.2.0 (git+https://github.com/moneydevkit/rust-lightning?rev=adf445e5d5e5c9f0f3c0e3925989404707e06e3f)", - "lightning-types 0.3.0 (git+https://github.com/moneydevkit/rust-lightning?rev=adf445e5d5e5c9f0f3c0e3925989404707e06e3f)", + "lightning 0.2.0 (git+https://github.com/moneydevkit/rust-lightning?rev=eecf53e7c763e8ae8e436585858db506a7aac588)", + "lightning-invoice 0.34.0 (git+https://github.com/moneydevkit/rust-lightning?rev=eecf53e7c763e8ae8e436585858db506a7aac588)", + "lightning-macros 0.2.0 (git+https://github.com/moneydevkit/rust-lightning?rev=eecf53e7c763e8ae8e436585858db506a7aac588)", + "lightning-types 0.3.0 (git+https://github.com/moneydevkit/rust-lightning?rev=eecf53e7c763e8ae8e436585858db506a7aac588)", "serde", "serde_json", ] @@ -1658,14 +1658,14 @@ dependencies = [ [[package]] name = "lightning-liquidity" version = "0.2.0" -source = "git+https://github.com/moneydevkit/rust-lightning?rev=eecf53e7c763e8ae8e436585858db506a7aac588#eecf53e7c763e8ae8e436585858db506a7aac588" +source = "git+https://github.com/moneydevkit/rust-lightning?rev=f56f47fe6c874771cd079faaacf96c42b32fbe72#f56f47fe6c874771cd079faaacf96c42b32fbe72" dependencies = [ "bitcoin", "chrono", - "lightning 0.2.0 (git+https://github.com/moneydevkit/rust-lightning?rev=eecf53e7c763e8ae8e436585858db506a7aac588)", - "lightning-invoice 0.34.0 (git+https://github.com/moneydevkit/rust-lightning?rev=eecf53e7c763e8ae8e436585858db506a7aac588)", - "lightning-macros 0.2.0 (git+https://github.com/moneydevkit/rust-lightning?rev=eecf53e7c763e8ae8e436585858db506a7aac588)", - "lightning-types 0.3.0 (git+https://github.com/moneydevkit/rust-lightning?rev=eecf53e7c763e8ae8e436585858db506a7aac588)", + "lightning 0.2.0 (git+https://github.com/moneydevkit/rust-lightning?rev=f56f47fe6c874771cd079faaacf96c42b32fbe72)", + "lightning-invoice 0.34.0 (git+https://github.com/moneydevkit/rust-lightning?rev=f56f47fe6c874771cd079faaacf96c42b32fbe72)", + "lightning-macros 0.2.0 (git+https://github.com/moneydevkit/rust-lightning?rev=f56f47fe6c874771cd079faaacf96c42b32fbe72)", + "lightning-types 0.3.0 (git+https://github.com/moneydevkit/rust-lightning?rev=f56f47fe6c874771cd079faaacf96c42b32fbe72)", "serde", "serde_json", ] @@ -1673,7 +1673,7 @@ dependencies = [ [[package]] name = "lightning-macros" version = "0.2.0" -source = "git+https://github.com/moneydevkit/rust-lightning?rev=adf445e5d5e5c9f0f3c0e3925989404707e06e3f#adf445e5d5e5c9f0f3c0e3925989404707e06e3f" +source = "git+https://github.com/moneydevkit/rust-lightning?rev=eecf53e7c763e8ae8e436585858db506a7aac588#eecf53e7c763e8ae8e436585858db506a7aac588" dependencies = [ "proc-macro2", "quote", @@ -1683,7 +1683,7 @@ dependencies = [ [[package]] name = "lightning-macros" version = "0.2.0" -source = "git+https://github.com/moneydevkit/rust-lightning?rev=eecf53e7c763e8ae8e436585858db506a7aac588#eecf53e7c763e8ae8e436585858db506a7aac588" +source = "git+https://github.com/moneydevkit/rust-lightning?rev=f56f47fe6c874771cd079faaacf96c42b32fbe72#f56f47fe6c874771cd079faaacf96c42b32fbe72" dependencies = [ "proc-macro2", "quote", @@ -1703,31 +1703,31 @@ dependencies = [ [[package]] name = "lightning-net-tokio" version = "0.2.0" -source = "git+https://github.com/moneydevkit/rust-lightning?rev=adf445e5d5e5c9f0f3c0e3925989404707e06e3f#adf445e5d5e5c9f0f3c0e3925989404707e06e3f" +source = "git+https://github.com/moneydevkit/rust-lightning?rev=eecf53e7c763e8ae8e436585858db506a7aac588#eecf53e7c763e8ae8e436585858db506a7aac588" dependencies = [ "bitcoin", - "lightning 0.2.0 (git+https://github.com/moneydevkit/rust-lightning?rev=adf445e5d5e5c9f0f3c0e3925989404707e06e3f)", + "lightning 0.2.0 (git+https://github.com/moneydevkit/rust-lightning?rev=eecf53e7c763e8ae8e436585858db506a7aac588)", "tokio", - "tokio-socks", ] [[package]] name = "lightning-net-tokio" version = "0.2.0" -source = "git+https://github.com/moneydevkit/rust-lightning?rev=eecf53e7c763e8ae8e436585858db506a7aac588#eecf53e7c763e8ae8e436585858db506a7aac588" +source = "git+https://github.com/moneydevkit/rust-lightning?rev=f56f47fe6c874771cd079faaacf96c42b32fbe72#f56f47fe6c874771cd079faaacf96c42b32fbe72" dependencies = [ "bitcoin", - "lightning 0.2.0 (git+https://github.com/moneydevkit/rust-lightning?rev=eecf53e7c763e8ae8e436585858db506a7aac588)", + "lightning 0.2.0 (git+https://github.com/moneydevkit/rust-lightning?rev=f56f47fe6c874771cd079faaacf96c42b32fbe72)", "tokio", + "tokio-socks", ] [[package]] name = "lightning-persister" version = "0.2.0" -source = "git+https://github.com/moneydevkit/rust-lightning?rev=adf445e5d5e5c9f0f3c0e3925989404707e06e3f#adf445e5d5e5c9f0f3c0e3925989404707e06e3f" +source = "git+https://github.com/moneydevkit/rust-lightning?rev=eecf53e7c763e8ae8e436585858db506a7aac588#eecf53e7c763e8ae8e436585858db506a7aac588" dependencies = [ "bitcoin", - "lightning 0.2.0 (git+https://github.com/moneydevkit/rust-lightning?rev=adf445e5d5e5c9f0f3c0e3925989404707e06e3f)", + "lightning 0.2.0 (git+https://github.com/moneydevkit/rust-lightning?rev=eecf53e7c763e8ae8e436585858db506a7aac588)", "tokio", "windows-sys 0.48.0", ] @@ -1735,10 +1735,10 @@ dependencies = [ [[package]] name = "lightning-persister" version = "0.2.0" -source = "git+https://github.com/moneydevkit/rust-lightning?rev=eecf53e7c763e8ae8e436585858db506a7aac588#eecf53e7c763e8ae8e436585858db506a7aac588" +source = "git+https://github.com/moneydevkit/rust-lightning?rev=f56f47fe6c874771cd079faaacf96c42b32fbe72#f56f47fe6c874771cd079faaacf96c42b32fbe72" dependencies = [ "bitcoin", - "lightning 0.2.0 (git+https://github.com/moneydevkit/rust-lightning?rev=eecf53e7c763e8ae8e436585858db506a7aac588)", + "lightning 0.2.0 (git+https://github.com/moneydevkit/rust-lightning?rev=f56f47fe6c874771cd079faaacf96c42b32fbe72)", "tokio", "windows-sys 0.48.0", ] @@ -1746,55 +1746,55 @@ dependencies = [ [[package]] name = "lightning-rapid-gossip-sync" version = "0.2.0" -source = "git+https://github.com/moneydevkit/rust-lightning?rev=adf445e5d5e5c9f0f3c0e3925989404707e06e3f#adf445e5d5e5c9f0f3c0e3925989404707e06e3f" +source = "git+https://github.com/moneydevkit/rust-lightning?rev=eecf53e7c763e8ae8e436585858db506a7aac588#eecf53e7c763e8ae8e436585858db506a7aac588" dependencies = [ "bitcoin", "bitcoin-io", "bitcoin_hashes", - "lightning 0.2.0 (git+https://github.com/moneydevkit/rust-lightning?rev=adf445e5d5e5c9f0f3c0e3925989404707e06e3f)", + "lightning 0.2.0 (git+https://github.com/moneydevkit/rust-lightning?rev=eecf53e7c763e8ae8e436585858db506a7aac588)", ] [[package]] name = "lightning-rapid-gossip-sync" version = "0.2.0" -source = "git+https://github.com/moneydevkit/rust-lightning?rev=eecf53e7c763e8ae8e436585858db506a7aac588#eecf53e7c763e8ae8e436585858db506a7aac588" +source = "git+https://github.com/moneydevkit/rust-lightning?rev=f56f47fe6c874771cd079faaacf96c42b32fbe72#f56f47fe6c874771cd079faaacf96c42b32fbe72" dependencies = [ "bitcoin", "bitcoin-io", "bitcoin_hashes", - "lightning 0.2.0 (git+https://github.com/moneydevkit/rust-lightning?rev=eecf53e7c763e8ae8e436585858db506a7aac588)", + "lightning 0.2.0 (git+https://github.com/moneydevkit/rust-lightning?rev=f56f47fe6c874771cd079faaacf96c42b32fbe72)", ] [[package]] name = "lightning-transaction-sync" version = "0.2.0" -source = "git+https://github.com/moneydevkit/rust-lightning?rev=adf445e5d5e5c9f0f3c0e3925989404707e06e3f#adf445e5d5e5c9f0f3c0e3925989404707e06e3f" +source = "git+https://github.com/moneydevkit/rust-lightning?rev=eecf53e7c763e8ae8e436585858db506a7aac588#eecf53e7c763e8ae8e436585858db506a7aac588" dependencies = [ "bitcoin", "electrum-client", "esplora-client", "futures", - "lightning 0.2.0 (git+https://github.com/moneydevkit/rust-lightning?rev=adf445e5d5e5c9f0f3c0e3925989404707e06e3f)", - "lightning-macros 0.2.0 (git+https://github.com/moneydevkit/rust-lightning?rev=adf445e5d5e5c9f0f3c0e3925989404707e06e3f)", + "lightning 0.2.0 (git+https://github.com/moneydevkit/rust-lightning?rev=eecf53e7c763e8ae8e436585858db506a7aac588)", + "lightning-macros 0.2.0 (git+https://github.com/moneydevkit/rust-lightning?rev=eecf53e7c763e8ae8e436585858db506a7aac588)", ] [[package]] name = "lightning-transaction-sync" version = "0.2.0" -source = "git+https://github.com/moneydevkit/rust-lightning?rev=eecf53e7c763e8ae8e436585858db506a7aac588#eecf53e7c763e8ae8e436585858db506a7aac588" +source = "git+https://github.com/moneydevkit/rust-lightning?rev=f56f47fe6c874771cd079faaacf96c42b32fbe72#f56f47fe6c874771cd079faaacf96c42b32fbe72" dependencies = [ "bitcoin", "electrum-client", "esplora-client", "futures", - "lightning 0.2.0 (git+https://github.com/moneydevkit/rust-lightning?rev=eecf53e7c763e8ae8e436585858db506a7aac588)", - "lightning-macros 0.2.0 (git+https://github.com/moneydevkit/rust-lightning?rev=eecf53e7c763e8ae8e436585858db506a7aac588)", + "lightning 0.2.0 (git+https://github.com/moneydevkit/rust-lightning?rev=f56f47fe6c874771cd079faaacf96c42b32fbe72)", + "lightning-macros 0.2.0 (git+https://github.com/moneydevkit/rust-lightning?rev=f56f47fe6c874771cd079faaacf96c42b32fbe72)", ] [[package]] name = "lightning-types" version = "0.3.0" -source = "git+https://github.com/moneydevkit/rust-lightning?rev=adf445e5d5e5c9f0f3c0e3925989404707e06e3f#adf445e5d5e5c9f0f3c0e3925989404707e06e3f" +source = "git+https://github.com/moneydevkit/rust-lightning?rev=eecf53e7c763e8ae8e436585858db506a7aac588#eecf53e7c763e8ae8e436585858db506a7aac588" dependencies = [ "bitcoin", ] @@ -1802,7 +1802,7 @@ dependencies = [ [[package]] name = "lightning-types" version = "0.3.0" -source = "git+https://github.com/moneydevkit/rust-lightning?rev=eecf53e7c763e8ae8e436585858db506a7aac588#eecf53e7c763e8ae8e436585858db506a7aac588" +source = "git+https://github.com/moneydevkit/rust-lightning?rev=f56f47fe6c874771cd079faaacf96c42b32fbe72#f56f47fe6c874771cd079faaacf96c42b32fbe72" dependencies = [ "bitcoin", ] @@ -1875,7 +1875,7 @@ dependencies = [ "hex-conservative", "hmac", "http-body-util", - "ldk-node 0.7.0 (git+https://github.com/moneydevkit/ldk-node?rev=c3aba2a47a6314968979de8fe772d9d1bcb3ee6e)", + "ldk-node 0.7.0 (git+https://github.com/moneydevkit/ldk-node?rev=5dce44b6e795560bbf62f49d3648308ce88a0586)", "ldk-node 0.7.0 (git+https://github.com/moneydevkit/ldk-node?rev=e5fcce065fa97c522de0f8fec87beb9e7e541456)", "log", "reqwest 0.12.28", @@ -2056,7 +2056,7 @@ checksum = "7edddbd0b52d732b21ad9a5fab5c704c14cd949e5e9a1ec5929a24fded1b904c" [[package]] name = "possiblyrandom" version = "0.2.0" -source = "git+https://github.com/moneydevkit/rust-lightning?rev=adf445e5d5e5c9f0f3c0e3925989404707e06e3f#adf445e5d5e5c9f0f3c0e3925989404707e06e3f" +source = "git+https://github.com/lightningdevkit/rust-lightning?rev=e9ce486a425933041b319ac72512227353310dc5#e9ce486a425933041b319ac72512227353310dc5" dependencies = [ "getrandom 0.2.17", ] @@ -2064,7 +2064,7 @@ dependencies = [ [[package]] name = "possiblyrandom" version = "0.2.0" -source = "git+https://github.com/lightningdevkit/rust-lightning?rev=e9ce486a425933041b319ac72512227353310dc5#e9ce486a425933041b319ac72512227353310dc5" +source = "git+https://github.com/moneydevkit/rust-lightning?rev=eecf53e7c763e8ae8e436585858db506a7aac588#eecf53e7c763e8ae8e436585858db506a7aac588" dependencies = [ "getrandom 0.2.17", ] @@ -2072,7 +2072,7 @@ dependencies = [ [[package]] name = "possiblyrandom" version = "0.2.0" -source = "git+https://github.com/moneydevkit/rust-lightning?rev=eecf53e7c763e8ae8e436585858db506a7aac588#eecf53e7c763e8ae8e436585858db506a7aac588" +source = "git+https://github.com/moneydevkit/rust-lightning?rev=f56f47fe6c874771cd079faaacf96c42b32fbe72#f56f47fe6c874771cd079faaacf96c42b32fbe72" dependencies = [ "getrandom 0.2.17", ] diff --git a/Cargo.toml b/Cargo.toml index 0f4fb32..449b3c8 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -15,8 +15,8 @@ path = "src/main.rs" demo = [] [dependencies] -# Branch: https://github.com/moneydevkit/ldk-node/tree/lsp-0.7.0_socks-support -ldk-node = { git = "https://github.com/moneydevkit/ldk-node", rev = "c3aba2a47a6314968979de8fe772d9d1bcb3ee6e" } +# Branch: https://github.com/moneydevkit/ldk-node/tree/lsp-0.7.0_accept-underpaying-htlcs_with_timing_logs +ldk-node = { git = "https://github.com/moneydevkit/ldk-node", rev = "5dce44b6e795560bbf62f49d3648308ce88a0586" } # Pinned to the same git rev as ldk-node's transitive pull to avoid duplicate # crate compilation. Verify with `cargo tree -d | grep bitcoin-payment-instructions`. From 636a55d614c33d8eb0ae31baf04b053c0eaba8fd Mon Sep 17 00:00:00 2001 From: amackillop Date: Fri, 8 May 2026 12:19:19 -0700 Subject: [PATCH 2/3] Apply mainnet probabilistic scorer defaults Mirror the per-network scoring overrides from mdk-checkout mdk-config.ts so the daemon and the JS client agree on routing behavior on mainnet. The main knob is base_penalty_msat raised to 100x the LDK default (1024 -> 102_400 msat), which biases pathfinding toward fewer-hop routes at the cost of paying up to ~102 sat extra per skipped hop. The other ten fields are written out as upstream LDK defaults rather than left to ldk-node's own Default impl. ldk-node is a fork and its defaults could drift; pinning each value here keeps us insulated. If lightning-node ever changes its mainnet values, this is the one place to update. Other networks (signet, regtest, testnet) skip the call and inherit ldk-node's defaults, matching lightning-node's signet config which leaves overrides empty. --- src/mdk/node.rs | 38 +++++++++++++++++++++++++++++++++++++- 1 file changed, 37 insertions(+), 1 deletion(-) diff --git a/src/mdk/node.rs b/src/mdk/node.rs index b598ebc..a0519ba 100644 --- a/src/mdk/node.rs +++ b/src/mdk/node.rs @@ -10,7 +10,10 @@ use ldk_node::bitcoin::secp256k1::PublicKey; use ldk_node::bitcoin::Network; use ldk_node::config::Config as LdkNodeConfig; use ldk_node::lightning::ln::msgs::SocketAddress; -use ldk_node::{Builder, Node}; +use ldk_node::lightning::routing::scoring::{ + ProbabilisticScoringDecayParameters, ProbabilisticScoringFeeParameters, +}; +use ldk_node::{Builder, Node, ProbabilisticScoringParameters}; use log::info; use crate::mdk::config::{ChainSource, NetworkInfra}; @@ -47,6 +50,10 @@ pub fn build_node( let mut builder = Builder::from_config(ldk_config); builder.set_log_facade_logger(); + if let Some(scoring_params) = network_scoring_params(config.network) { + builder.set_scoring_params(scoring_params); + } + if let Some(ref proxy_url) = config.socks_proxy { let addr = resolve_socks_proxy(proxy_url)?; builder.set_socks5_proxy(addr); @@ -127,6 +134,35 @@ fn resolve_socks_proxy(raw: &str) -> Result { .ok_or_else(|| MdkError::InvalidInput(format!("cannot resolve SOCKS5 proxy: {host_port}"))) } +/// Per-network defaults for the probabilistic scorer. +/// +/// Mainnet biases pathfinding toward fewer hops by raising `base_penalty_msat` +/// to 100x the LDK default (1024 → 102_400 msat). All other fields are pinned +/// to upstream LDK defaults so any future drift in ldk-node's defaults does +/// not silently change routing behavior. Other networks fall through to +/// ldk-node's own defaults (no `set_scoring_params` call). +fn network_scoring_params(network: Network) -> Option { + match network { + Network::Bitcoin => Some(ProbabilisticScoringParameters { + fee_params: ProbabilisticScoringFeeParameters { + base_penalty_msat: 102_400, + base_penalty_amount_multiplier_msat: 131_072, + liquidity_penalty_multiplier_msat: 0, + liquidity_penalty_amount_multiplier_msat: 0, + historical_liquidity_penalty_multiplier_msat: 10_000, + historical_liquidity_penalty_amount_multiplier_msat: 1_250, + manual_node_penalties: Default::default(), + anti_probing_penalty_msat: 250, + considered_impossible_penalty_msat: 100_000_000_000, + linear_success_probability: false, + probing_diversity_penalty_msat: 0, + }, + decay_params: ProbabilisticScoringDecayParameters::default(), + }), + _ => None, + } +} + pub fn derive_vss_identifier(mnemonic: &Mnemonic) -> String { let phrase = mnemonic.to_string(); sha256::Hash::hash(phrase.as_bytes()).to_string() From d89832fff21162d7e9be6d554c3cfed5fdb30ad4 Mon Sep 17 00:00:00 2001 From: amackillop Date: Fri, 8 May 2026 12:30:39 -0700 Subject: [PATCH 3/3] Allow scoring param overrides via config (mainnet only) Add a `[node.scoring]` TOML section that layers per-field overrides on top of the mainnet baseline. Any omitted field falls through to the baseline; an empty or missing section preserves current behavior. The intent is internal experimentation, not a user-facing knob. We want a single place to point at when tuning scoring on a running node, instead of recompiling. If a value proves out, fold it back into the baseline in `resolve_scoring_params` and remove the override from the operator's config. Tuning only makes sense on mainnet (the public network has the gossip we are biasing against), so on signet/regtest/testnet the baseline doesn't apply and overrides are ignored with a warning. This keeps the scoring code branch-free in the common case and avoids inventing meaningless per-network defaults. Decay parameters and `manual_node_penalties` are deliberately not exposed. lightning-node's mdk-config.ts doesn't expose them either, and `manual_node_penalties` is a HashMap that doesn't map cleanly onto TOML keys. Easy to add later if needed. --- src/daemon/config.rs | 41 ++++++++++ src/main.rs | 1 + src/mdk/node.rs | 182 ++++++++++++++++++++++++++++++++++++------- 3 files changed, 198 insertions(+), 26 deletions(-) diff --git a/src/daemon/config.rs b/src/daemon/config.rs index 1043ab1..700229c 100644 --- a/src/daemon/config.rs +++ b/src/daemon/config.rs @@ -7,6 +7,7 @@ use ldk_node::bitcoin::Network; use ldk_node::lightning::ln::msgs::SocketAddress; use ldk_node::lightning::routing::gossip::NodeAlias; use log::LevelFilter; +use mdk::node::ScoringOverrides; use serde::Deserialize; #[derive(Deserialize)] @@ -24,6 +25,42 @@ struct NodeSection { rest_service_address: Option, alias: Option, pathfinding_scores_source_url: Option, + scoring: Option, +} + +/// `[node.scoring]` — overrides for `ProbabilisticScoringFeeParameters`. +/// Any omitted field falls back to the network default (see `mdk::node`). +#[derive(Deserialize, Default)] +struct ScoringSection { + base_penalty_msat: Option, + base_penalty_amount_multiplier_msat: Option, + liquidity_penalty_multiplier_msat: Option, + liquidity_penalty_amount_multiplier_msat: Option, + historical_liquidity_penalty_multiplier_msat: Option, + historical_liquidity_penalty_amount_multiplier_msat: Option, + anti_probing_penalty_msat: Option, + considered_impossible_penalty_msat: Option, + linear_success_probability: Option, + probing_diversity_penalty_msat: Option, +} + +impl From for ScoringOverrides { + fn from(s: ScoringSection) -> Self { + Self { + base_penalty_msat: s.base_penalty_msat, + base_penalty_amount_multiplier_msat: s.base_penalty_amount_multiplier_msat, + liquidity_penalty_multiplier_msat: s.liquidity_penalty_multiplier_msat, + liquidity_penalty_amount_multiplier_msat: s.liquidity_penalty_amount_multiplier_msat, + historical_liquidity_penalty_multiplier_msat: s + .historical_liquidity_penalty_multiplier_msat, + historical_liquidity_penalty_amount_multiplier_msat: s + .historical_liquidity_penalty_amount_multiplier_msat, + anti_probing_penalty_msat: s.anti_probing_penalty_msat, + considered_impossible_penalty_msat: s.considered_impossible_penalty_msat, + linear_success_probability: s.linear_success_probability, + probing_diversity_penalty_msat: s.probing_diversity_penalty_msat, + } + } } #[derive(Deserialize)] @@ -52,6 +89,7 @@ pub struct MdkConfig { pub storage_dir_path: Option, pub log_level: LevelFilter, pub pathfinding_scores_source_url: Option, + pub scoring_overrides: ScoringOverrides, } pub fn load_config(path: &str) -> io::Result { @@ -109,6 +147,8 @@ pub fn load_config(path: &str) -> io::Result { None => LevelFilter::Debug, }; + let scoring_overrides = node.scoring.map(ScoringOverrides::from).unwrap_or_default(); + Ok(MdkConfig { network, listening_addrs, @@ -118,6 +158,7 @@ pub fn load_config(path: &str) -> io::Result { storage_dir_path, log_level, pathfinding_scores_source_url: node.pathfinding_scores_source_url, + scoring_overrides, }) } diff --git a/src/main.rs b/src/main.rs index 755e25f..eff75b6 100644 --- a/src/main.rs +++ b/src/main.rs @@ -131,6 +131,7 @@ fn main() { pathfinding_scores_source_url: config_file.pathfinding_scores_source_url, mnemonic: mnemonic_phrase, infra, + scoring_overrides: config_file.scoring_overrides, }; // Separate HTTP client for daemon concerns (webhooks, expiry monitor). diff --git a/src/mdk/node.rs b/src/mdk/node.rs index a0519ba..3e2e697 100644 --- a/src/mdk/node.rs +++ b/src/mdk/node.rs @@ -14,7 +14,7 @@ use ldk_node::lightning::routing::scoring::{ ProbabilisticScoringDecayParameters, ProbabilisticScoringFeeParameters, }; use ldk_node::{Builder, Node, ProbabilisticScoringParameters}; -use log::info; +use log::{info, warn}; use crate::mdk::config::{ChainSource, NetworkInfra}; use crate::mdk::error::MdkError; @@ -29,6 +29,52 @@ pub struct NodeConfig { pub pathfinding_scores_source_url: Option, pub mnemonic: String, pub infra: NetworkInfra, + pub scoring_overrides: ScoringOverrides, +} + +/// Per-field overrides for the probabilistic scorer's fee parameters. +/// +/// Only applied on mainnet; ignored elsewhere (with a warning if non-empty). +/// Decay parameters and `manual_node_penalties` are not user-tunable. +#[derive(Debug, Default, Clone)] +pub struct ScoringOverrides { + pub base_penalty_msat: Option, + pub base_penalty_amount_multiplier_msat: Option, + pub liquidity_penalty_multiplier_msat: Option, + pub liquidity_penalty_amount_multiplier_msat: Option, + pub historical_liquidity_penalty_multiplier_msat: Option, + pub historical_liquidity_penalty_amount_multiplier_msat: Option, + pub anti_probing_penalty_msat: Option, + pub considered_impossible_penalty_msat: Option, + pub linear_success_probability: Option, + pub probing_diversity_penalty_msat: Option, +} + +impl ScoringOverrides { + pub fn is_empty(&self) -> bool { + let Self { + base_penalty_msat, + base_penalty_amount_multiplier_msat, + liquidity_penalty_multiplier_msat, + liquidity_penalty_amount_multiplier_msat, + historical_liquidity_penalty_multiplier_msat, + historical_liquidity_penalty_amount_multiplier_msat, + anti_probing_penalty_msat, + considered_impossible_penalty_msat, + linear_success_probability, + probing_diversity_penalty_msat, + } = self; + base_penalty_msat.is_none() + && base_penalty_amount_multiplier_msat.is_none() + && liquidity_penalty_multiplier_msat.is_none() + && liquidity_penalty_amount_multiplier_msat.is_none() + && historical_liquidity_penalty_multiplier_msat.is_none() + && historical_liquidity_penalty_amount_multiplier_msat.is_none() + && anti_probing_penalty_msat.is_none() + && considered_impossible_penalty_msat.is_none() + && linear_success_probability.is_none() + && probing_diversity_penalty_msat.is_none() + } } pub fn build_node( @@ -50,8 +96,13 @@ pub fn build_node( let mut builder = Builder::from_config(ldk_config); builder.set_log_facade_logger(); - if let Some(scoring_params) = network_scoring_params(config.network) { - builder.set_scoring_params(scoring_params); + if config.network == Network::Bitcoin { + builder.set_scoring_params(resolve_scoring_params(&config.scoring_overrides)); + } else if !config.scoring_overrides.is_empty() { + warn!( + "[node.scoring] overrides are mainnet-only; ignoring on {}", + config.network + ); } if let Some(ref proxy_url) = config.socks_proxy { @@ -134,36 +185,115 @@ fn resolve_socks_proxy(raw: &str) -> Result { .ok_or_else(|| MdkError::InvalidInput(format!("cannot resolve SOCKS5 proxy: {host_port}"))) } -/// Per-network defaults for the probabilistic scorer. +/// Mainnet scoring parameters with user overrides applied on top. /// -/// Mainnet biases pathfinding toward fewer hops by raising `base_penalty_msat` +/// Baseline biases pathfinding toward fewer hops by raising `base_penalty_msat` /// to 100x the LDK default (1024 → 102_400 msat). All other fields are pinned /// to upstream LDK defaults so any future drift in ldk-node's defaults does -/// not silently change routing behavior. Other networks fall through to -/// ldk-node's own defaults (no `set_scoring_params` call). -fn network_scoring_params(network: Network) -> Option { - match network { - Network::Bitcoin => Some(ProbabilisticScoringParameters { - fee_params: ProbabilisticScoringFeeParameters { - base_penalty_msat: 102_400, - base_penalty_amount_multiplier_msat: 131_072, - liquidity_penalty_multiplier_msat: 0, - liquidity_penalty_amount_multiplier_msat: 0, - historical_liquidity_penalty_multiplier_msat: 10_000, - historical_liquidity_penalty_amount_multiplier_msat: 1_250, - manual_node_penalties: Default::default(), - anti_probing_penalty_msat: 250, - considered_impossible_penalty_msat: 100_000_000_000, - linear_success_probability: false, - probing_diversity_penalty_msat: 0, - }, - decay_params: ProbabilisticScoringDecayParameters::default(), - }), - _ => None, +/// not silently change routing behavior on us. Each field set in `overrides` +/// replaces the corresponding baseline value. +fn resolve_scoring_params(overrides: &ScoringOverrides) -> ProbabilisticScoringParameters { + let mut params = ProbabilisticScoringParameters { + fee_params: ProbabilisticScoringFeeParameters { + base_penalty_msat: 102_400, + base_penalty_amount_multiplier_msat: 131_072, + liquidity_penalty_multiplier_msat: 0, + liquidity_penalty_amount_multiplier_msat: 0, + historical_liquidity_penalty_multiplier_msat: 10_000, + historical_liquidity_penalty_amount_multiplier_msat: 1_250, + manual_node_penalties: Default::default(), + anti_probing_penalty_msat: 250, + considered_impossible_penalty_msat: 100_000_000_000, + linear_success_probability: false, + probing_diversity_penalty_msat: 0, + }, + decay_params: ProbabilisticScoringDecayParameters::default(), + }; + let f = &mut params.fee_params; + if let Some(v) = overrides.base_penalty_msat { + f.base_penalty_msat = v; + } + if let Some(v) = overrides.base_penalty_amount_multiplier_msat { + f.base_penalty_amount_multiplier_msat = v; + } + if let Some(v) = overrides.liquidity_penalty_multiplier_msat { + f.liquidity_penalty_multiplier_msat = v; + } + if let Some(v) = overrides.liquidity_penalty_amount_multiplier_msat { + f.liquidity_penalty_amount_multiplier_msat = v; + } + if let Some(v) = overrides.historical_liquidity_penalty_multiplier_msat { + f.historical_liquidity_penalty_multiplier_msat = v; + } + if let Some(v) = overrides.historical_liquidity_penalty_amount_multiplier_msat { + f.historical_liquidity_penalty_amount_multiplier_msat = v; + } + if let Some(v) = overrides.anti_probing_penalty_msat { + f.anti_probing_penalty_msat = v; } + if let Some(v) = overrides.considered_impossible_penalty_msat { + f.considered_impossible_penalty_msat = v; + } + if let Some(v) = overrides.linear_success_probability { + f.linear_success_probability = v; + } + if let Some(v) = overrides.probing_diversity_penalty_msat { + f.probing_diversity_penalty_msat = v; + } + params } pub fn derive_vss_identifier(mnemonic: &Mnemonic) -> String { let phrase = mnemonic.to_string(); sha256::Hash::hash(phrase.as_bytes()).to_string() } + +#[cfg(test)] +mod tests { + use super::*; + + #[test] + fn mainnet_default_uses_100x_base_penalty() { + let params = resolve_scoring_params(&ScoringOverrides::default()); + assert_eq!(params.fee_params.base_penalty_msat, 102_400); + assert_eq!(params.fee_params.anti_probing_penalty_msat, 250); + assert_eq!( + params.fee_params.considered_impossible_penalty_msat, + 100_000_000_000 + ); + } + + #[test] + fn override_replaces_only_specified_fields() { + let overrides = ScoringOverrides { + base_penalty_msat: Some(7), + linear_success_probability: Some(true), + ..Default::default() + }; + let params = resolve_scoring_params(&overrides); + // Overridden fields take new values. + assert_eq!(params.fee_params.base_penalty_msat, 7); + assert!(params.fee_params.linear_success_probability); + // Untouched fields keep the mainnet default. + assert_eq!( + params.fee_params.base_penalty_amount_multiplier_msat, + 131_072 + ); + assert_eq!(params.fee_params.anti_probing_penalty_msat, 250); + } + + #[test] + fn is_empty_distinguishes_default_from_any_override() { + assert!(ScoringOverrides::default().is_empty()); + assert!(!ScoringOverrides { + base_penalty_msat: Some(0), + ..Default::default() + } + .is_empty()); + assert!(!ScoringOverrides { + linear_success_probability: Some(false), + ..Default::default() + } + .is_empty()); + } +}