From fc8350ae2cb26b5010effa3eb2a6050c9dc3d997 Mon Sep 17 00:00:00 2001 From: Joost Jager Date: Thu, 12 Feb 2026 12:51:19 +0100 Subject: [PATCH 1/2] DEV: break ldk api --- lightning/src/routing/scoring.rs | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/lightning/src/routing/scoring.rs b/lightning/src/routing/scoring.rs index 47621e37380..4cc0ff97fc4 100644 --- a/lightning/src/routing/scoring.rs +++ b/lightning/src/routing/scoring.rs @@ -483,16 +483,16 @@ pub struct ProbabilisticScorer>, L: Logger> { decay_params: ProbabilisticScoringDecayParameters, network_graph: G, logger: L, - channel_liquidities: ChannelLiquidities, + channel_liquidities: ChannelLiquiditiesX, /// The last time we were given via a [`ScoreUpdate`] method. This does not imply that we've /// decayed every liquidity bound up to that time. last_update_time: Duration, } /// Container for live and historical liquidity bounds for each channel. #[derive(Clone)] -pub struct ChannelLiquidities(HashMap); +pub struct ChannelLiquiditiesX(HashMap); -impl ChannelLiquidities { +impl ChannelLiquiditiesX { fn new() -> Self { Self(new_hash_map()) } @@ -551,18 +551,18 @@ impl ChannelLiquidities { } } -impl Readable for ChannelLiquidities { +impl Readable for ChannelLiquiditiesX { #[inline] fn read(r: &mut R) -> Result { let mut channel_liquidities = new_hash_map(); read_tlv_fields!(r, { (0, channel_liquidities, required), }); - Ok(ChannelLiquidities(channel_liquidities)) + Ok(ChannelLiquiditiesX(channel_liquidities)) } } -impl Writeable for ChannelLiquidities { +impl Writeable for ChannelLiquiditiesX { #[inline] fn write(&self, w: &mut W) -> Result<(), io::Error> { write_tlv_fields!(w, { @@ -971,7 +971,7 @@ impl>, L: Logger> ProbabilisticScorer { decay_params, network_graph, logger, - channel_liquidities: ChannelLiquidities::new(), + channel_liquidities: ChannelLiquiditiesX::new(), last_update_time: Duration::from_secs(0), } } @@ -1193,12 +1193,12 @@ impl>, L: Logger> ProbabilisticScorer { } /// Overwrite the scorer state with the given external scores. - pub fn set_scores(&mut self, external_scores: ChannelLiquidities) { + pub fn set_scores(&mut self, external_scores: ChannelLiquiditiesX) { _ = mem::replace(&mut self.channel_liquidities, external_scores); } /// Returns the current scores. - pub fn scores(&self) -> &ChannelLiquidities { + pub fn scores(&self) -> &ChannelLiquiditiesX { &self.channel_liquidities } } @@ -1848,7 +1848,7 @@ impl> + Clone, L: Logger + Clone> CombinedScor /// Merge external channel liquidity information into the scorer. pub fn merge( - &mut self, mut external_scores: ChannelLiquidities, duration_since_epoch: Duration, + &mut self, mut external_scores: ChannelLiquiditiesX, duration_since_epoch: Duration, ) { // Decay both sets of scores to make them comparable and mergeable. self.local_only_scorer.time_passed(duration_since_epoch); @@ -1866,7 +1866,7 @@ impl> + Clone, L: Logger + Clone> CombinedScor } /// Overwrite the scorer state with the given external scores. - pub fn set_scores(&mut self, external_scores: ChannelLiquidities) { + pub fn set_scores(&mut self, external_scores: ChannelLiquiditiesX) { self.scorer.set_scores(external_scores); } } @@ -2506,7 +2506,7 @@ impl>, L: Logger> r: &mut R, args: (ProbabilisticScoringDecayParameters, G, L) ) -> Result { let (decay_params, network_graph, logger) = args; - let channel_liquidities = ChannelLiquidities::read(r)?; + let channel_liquidities = ChannelLiquiditiesX::read(r)?; let mut last_update_time = Duration::from_secs(0); for (_, liq) in channel_liquidities.0.iter() { last_update_time = cmp::max(last_update_time, liq.last_updated); @@ -2609,7 +2609,7 @@ mod tests { BlindedTail, CandidateRouteHop, Path, PublicHopCandidate, RouteHop, }; use crate::routing::scoring::{ - ChannelLiquidities, ChannelUsage, CombinedScorer, ScoreLookUp, ScoreUpdate, + ChannelLiquiditiesX, ChannelUsage, CombinedScorer, ScoreLookUp, ScoreUpdate, }; use crate::util::ser::{ReadableArgs, Writeable}; use crate::util::test_utils::{self, TestLogger}; @@ -4214,7 +4214,7 @@ mod tests { logger_rc.as_ref(), ); - let mut external_scores = ChannelLiquidities::new(); + let mut external_scores = ChannelLiquiditiesX::new(); external_scores.insert(42, external_liquidity); { From f4d459d9a3f4d9b57511057a4a331bc6c1e21e7d Mon Sep 17 00:00:00 2001 From: Joost Jager Date: Thu, 12 Feb 2026 15:36:22 +0100 Subject: [PATCH 2/2] Allow overriding ldk-node fork/branch from PR description Parse the PR body for a `ldk-node: owner/repo#branch` line and use it to check out a custom ldk-node fork/branch for the integration test. When a custom branch is specified, the Cargo.toml patching step is skipped since the branch is expected to already have the right dependencies configured. Falls back to `lightningdevkit/ldk-node` at its default branch (with patching) when not specified or on push events. Co-Authored-By: Claude Opus 4.6 --- .github/workflows/ldk-node-integration.yml | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ldk-node-integration.yml b/.github/workflows/ldk-node-integration.yml index 446abd40a07..afb9dab7761 100644 --- a/.github/workflows/ldk-node-integration.yml +++ b/.github/workflows/ldk-node-integration.yml @@ -15,15 +15,28 @@ jobs: uses: actions/checkout@v3 with: path: rust-lightning + - name: Determine LDK Node repo and branch + id: ldk-node-ref + if: github.event_name == 'pull_request' + env: + PR_BODY: ${{ github.event.pull_request.body }} + run: | + LDK_NODE_REF=$(echo "$PR_BODY" | sed -n 's/^[[:space:]]*ldk-node:[[:space:]]*//p' | tr -d '[:space:]') + if [ -n "$LDK_NODE_REF" ]; then + echo "repo=$(echo "$LDK_NODE_REF" | cut -d'#' -f1)" >> "$GITHUB_OUTPUT" + echo "ref=$(echo "$LDK_NODE_REF" | cut -d'#' -s -f2)" >> "$GITHUB_OUTPUT" + fi - name: Checkout LDK Node uses: actions/checkout@v3 with: - repository: lightningdevkit/ldk-node + repository: ${{ steps.ldk-node-ref.outputs.repo || 'lightningdevkit/ldk-node' }} + ref: ${{ steps.ldk-node-ref.outputs.ref || '' }} path: ldk-node - name: Install Rust stable toolchain run: | curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y --profile=minimal --default-toolchain stable - - name: Run LDK Node Integration Tests + - name: Patch LDK Node Cargo.toml + if: steps.ldk-node-ref.outputs.repo == '' run: | cd ldk-node cat <> Cargo.toml @@ -53,5 +66,8 @@ jobs: lightning-liquidity = { path = "../rust-lightning/lightning-liquidity" } lightning-macros = { path = "../rust-lightning/lightning-macros" } EOF + - name: Run LDK Node Integration Tests + run: | + cd ldk-node cargo check cargo check --features uniffi