@@ -1620,9 +1620,34 @@ class LightningRepo @Inject constructor(
16201620 graphNodeCount = graph?.nodeCount,
16211621 graphChannelCount = graph?.channelCount,
16221622 latestRgsSyncTimestamp = graph?.latestRgsSyncTimestamp,
1623+ latestPathfindingScoresSyncTimestamp = state.nodeStatus?.latestPathfindingScoresSyncTimestamp,
16231624 syncHealthy = state.isSyncHealthy,
16241625 )
16251626 }
1627+
1628+ suspend fun resetPathfindingScores (walletIndex : Int = 0): Result <Unit > = withContext(bgDispatcher) {
1629+ Logger .info(" Resetting pathfinding scores" , context = TAG )
1630+
1631+ waitForNodeToStop().onFailure { return @withContext Result .failure(it) }
1632+ stop().onFailure {
1633+ Logger .error(" Failed to stop node during pathfinding scores reset" , it, context = TAG )
1634+ return @withContext Result .failure(it)
1635+ }
1636+
1637+ runCatching {
1638+ vssBackupClientLdk.setup(walletIndex).getOrThrow()
1639+ vssBackupClientLdk.deleteObject(VSS_KEY_SCORER ).getOrThrow()
1640+ vssBackupClientLdk.deleteObject(VSS_KEY_EXTERNAL_SCORES_CACHE ).getOrThrow()
1641+ }.onFailure {
1642+ Logger .error(" Failed to delete pathfinding scores from VSS" , it, context = TAG )
1643+ start(walletIndex = walletIndex, shouldRetry = false )
1644+ return @withContext Result .failure(it)
1645+ }
1646+
1647+ start(walletIndex = walletIndex, shouldRetry = false ).onSuccess {
1648+ Logger .info(" Pathfinding scores reset" , context = TAG )
1649+ }
1650+ }
16261651 // endregion
16271652
16281653 suspend fun restartNode (): Result <Unit > = withContext(bgDispatcher) {
@@ -1642,6 +1667,8 @@ class LightningRepo @Inject constructor(
16421667 companion object {
16431668 private const val TAG = " LightningRepo"
16441669 private const val LENGTH_CHANNEL_ID_PREVIEW = 10
1670+ private const val VSS_KEY_SCORER = " scorer"
1671+ private const val VSS_KEY_EXTERNAL_SCORES_CACHE = " external_pathfinding_scores_cache"
16451672 private const val MS_SYNC_LOOP_DEBOUNCE = 500L
16461673 private const val SYNC_RETRY_DELAY_MS = 15_000L
16471674 private val CHANNELS_USABLE_TIMEOUT = 15 .seconds
@@ -1702,6 +1729,7 @@ data class ProbeReadiness(
17021729 val graphNodeCount : Int? ,
17031730 val graphChannelCount : Int? ,
17041731 val latestRgsSyncTimestamp : ULong? ,
1732+ val latestPathfindingScoresSyncTimestamp : ULong? ,
17051733 val syncHealthy : Boolean ,
17061734) {
17071735 val ready: Boolean
0 commit comments