File tree Expand file tree Collapse file tree
main/java/to/bitkit/repositories
test/java/to/bitkit/repositories Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -483,13 +483,14 @@ class LightningRepo @Inject constructor(
483483 if (lightningService.node != null ) {
484484 lightningService.stop()
485485 }
486- clearNetworkGraph(walletIndex)
486+ // Propagate VSS failures: a manual reset that leaves the graph in VSS is ineffective.
487+ clearNetworkGraph(walletIndex).getOrThrow()
487488 }
488489 }
489490
490- private suspend fun clearNetworkGraph (walletIndex : Int ) {
491+ private suspend fun clearNetworkGraph (walletIndex : Int ): Result < Unit > {
491492 lightningService.resetNetworkGraph(walletIndex)
492- runCatching {
493+ return runCatching {
493494 vssBackupClientLdk.setup(walletIndex).getOrThrow()
494495 vssBackupClientLdk.deleteObject(" network_graph" ).getOrThrow()
495496 Logger .info(" Cleared network graph from VSS" , context = TAG )
Original file line number Diff line number Diff line change @@ -188,6 +188,18 @@ class LightningRepoTest : BaseUnitTest() {
188188 verify(vssBackupClientLdk).deleteObject(eq(" network_graph" ), any())
189189 }
190190
191+ @Test
192+ fun `resetNetworkGraph fails when VSS delete fails` () = test {
193+ whenever(vssBackupClientLdk.setup(any())).thenReturn(Result .success(Unit ))
194+ whenever(vssBackupClientLdk.deleteObject(any(), any()))
195+ .thenReturn(Result .failure(RuntimeException (" vss unavailable" )))
196+
197+ val result = sut.resetNetworkGraph()
198+
199+ assertTrue(result.isFailure)
200+ verify(lightningService).resetNetworkGraph(0 )
201+ }
202+
191203 @Test
192204 fun `newAddress should fail when node is not running` () = test {
193205 val result = sut.newAddress()
You can’t perform that action at this time.
0 commit comments