feat: add LDK debug action to export pathfinding scores#915
Draft
feat: add LDK debug action to export pathfinding scores#915
Conversation
Mirrors the existing network-graph export pattern: a new "Export Scorer" button under a PATHFINDING SCORER section in LDK Debug calls node.exportPathfindingScores(), writes the bytes to cacheDir/exports, and triggers the Android share sheet via FileProvider so the file can be moved off-device for inspection (e.g. with the scorer-inspect CLI in synonymdev/ldk-node). Also nulls the regtest ldkScorerUrl. The regtest endpoint serves a 5-byte minimal payload, so the only effect of pointing the node at it is a no-op merge; setting it to null makes "we don't use the scorer on regtest" explicit.
2 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR adds an "Export Scorer" action to the LDK Debug screen that dumps the running node's merged pathfinding scorer to a file and triggers an Android share sheet, so it can be moved off-device for inspection. It also nulls the regtest scorer URL since the staging endpoint serves a 5-byte minimal payload.
Depends on:
node.exportPathfindingScores()which is already inldk-node 0.7.0-rc.36)Description
Mirrors the existing
exportNetworkGraphflow exactly:PATHFINDING SCORERsection inLdkDebugScreen.LdkDebugViewModel.exportScorer()writes to<context.cacheDir>/exports/pathfinding_scores.binand surfaces the file viaFileProviderso a share sheet pops up — same UX as Export Network Graph.LightningService.exportPathfindingScoresToFile()is a thin wrapper aroundnode.exportPathfindingScores()(existing UDL binding).LoggerLdk.exportPathfindingScoresToFile()writes the raw bytes; logs the byte count.Env.ldkScorerUrlforNetwork.REGTESTis set tonull. The staging endpoint (https://api.stag0.blocktank.to/scorer) serves 5 bytes — minimal/empty data — so wiring it through accomplishes nothing. Making this explicit matches "we don't use the scorer on regtest".Dev-only screen — no localized strings (per CLAUDE.md "NEVER add string resources for strings used only in dev settings screens").
Preview
QA Notes
./gradlew installDevDebug(orinstallTnetDebug/installMainnetper network)..binsomewhere off-device.adb shell "run-as to.bitkit.dev cat files/cache/exports/pathfinding_scores.bin" > /tmp/scorer_local.bin(adjust app id per flavor).ChannelLiquidities-encoded — same wire format as the served scorer athttps://api.blocktank.to/scorer-prod. They can be inspected with thescorer-inspectCLI from feat(tools): add scorer-inspect CLI with text/csv/json output ldk-node#79 once that lands../gradlew compileDevDebugKotlin testDevDebugUnitTest detekt— all pass; only pre-existing detekt warnings (none introduced by this change).🤖 Generated with Claude Code