@@ -1323,67 +1323,113 @@ class LightningRepoTest : BaseUnitTest() {
13231323 val onEvent = startNodeAndCaptureEvents()
13241324
13251325 val result = async { sut.waitForProbeOutcome(setOf (probePaymentA)) }
1326- onEvent(Event .ProbeSuccessful (paymentId = probePaymentA, paymentHash = probeHashA))
1326+ onEvent(Event .ProbeSuccessful (paymentId = probePaymentA, paymentHash = probeHashA, routeFeeMsat = 123uL ))
13271327
13281328 val outcome = result.await().getOrThrow()
13291329 assertIs<ProbeOutcome .Success >(outcome)
13301330 assertEquals(probePaymentA, outcome.paymentId)
13311331 assertEquals(probeHashA, outcome.paymentHash)
1332+ assertEquals(123uL , outcome.routeFeeMsat)
13321333 }
13331334
13341335 @Test
13351336 fun `waitForProbeOutcome returns cached success when event arrives before wait` () = test {
13361337 val onEvent = startNodeAndCaptureEvents()
1337- onEvent(Event .ProbeSuccessful (paymentId = probePaymentA, paymentHash = probeHashA))
1338+ onEvent(Event .ProbeSuccessful (paymentId = probePaymentA, paymentHash = probeHashA, routeFeeMsat = 123uL ))
13381339
13391340 val outcome = sut.waitForProbeOutcome(setOf (probePaymentA)).getOrThrow()
13401341
13411342 assertIs<ProbeOutcome .Success >(outcome)
13421343 assertEquals(probePaymentA, outcome.paymentId)
13431344 assertEquals(probeHashA, outcome.paymentHash)
1345+ assertEquals(123uL , outcome.routeFeeMsat)
13441346 }
13451347
13461348 @Test
13471349 fun `waitForProbeOutcome returns last failure only after all tracked probes fail` () = test {
13481350 val onEvent = startNodeAndCaptureEvents()
13491351 val result = async { sut.waitForProbeOutcome(setOf (probePaymentA, probePaymentB)) }
13501352
1351- onEvent(Event .ProbeFailed (paymentId = probePaymentA, paymentHash = probeHashA, shortChannelId = 1uL ))
1352- onEvent(Event .ProbeFailed (paymentId = probePaymentB, paymentHash = probeHashB, shortChannelId = 2uL ))
1353+ onEvent(
1354+ Event .ProbeFailed (
1355+ paymentId = probePaymentA,
1356+ paymentHash = probeHashA,
1357+ shortChannelId = 1uL ,
1358+ routeFeeMsat = 123uL ,
1359+ )
1360+ )
1361+ onEvent(
1362+ Event .ProbeFailed (
1363+ paymentId = probePaymentB,
1364+ paymentHash = probeHashB,
1365+ shortChannelId = 990_718_250_873_192_449uL ,
1366+ routeFeeMsat = 456uL ,
1367+ )
1368+ )
13531369
13541370 val outcome = result.await().getOrThrow()
13551371 assertIs<ProbeOutcome .Failure >(outcome)
13561372 assertEquals(probePaymentB, outcome.paymentId)
13571373 assertEquals(probeHashB, outcome.paymentHash)
1358- assertEquals(2uL , outcome.shortChannelId)
1374+ assertEquals(" 990718250873192449" , outcome.shortChannelId)
1375+ assertEquals(456uL , outcome.routeFeeMsat)
13591376 }
13601377
13611378 @Test
13621379 fun `waitForProbeOutcome returns first success even when another path already failed` () = test {
13631380 val onEvent = startNodeAndCaptureEvents()
13641381 val result = async { sut.waitForProbeOutcome(setOf (probePaymentA, probePaymentB)) }
13651382
1366- onEvent(Event .ProbeFailed (paymentId = probePaymentA, paymentHash = probeHashA, shortChannelId = 1uL ))
1367- onEvent(Event .ProbeSuccessful (paymentId = probePaymentB, paymentHash = probeHashB))
1383+ onEvent(
1384+ Event .ProbeFailed (
1385+ paymentId = probePaymentA,
1386+ paymentHash = probeHashA,
1387+ shortChannelId = 1uL ,
1388+ routeFeeMsat = 123uL ,
1389+ )
1390+ )
1391+ onEvent(
1392+ Event .ProbeSuccessful (
1393+ paymentId = probePaymentB,
1394+ paymentHash = probeHashB,
1395+ routeFeeMsat = 456uL ,
1396+ )
1397+ )
13681398
13691399 val outcome = result.await().getOrThrow()
13701400 assertIs<ProbeOutcome .Success >(outcome)
13711401 assertEquals(probePaymentB, outcome.paymentId)
13721402 assertEquals(probeHashB, outcome.paymentHash)
1403+ assertEquals(456uL , outcome.routeFeeMsat)
13731404 }
13741405
13751406 @Test
13761407 fun `waitForProbeOutcome does not hang on partial cached failures` () = test {
13771408 val onEvent = startNodeAndCaptureEvents()
1378- onEvent(Event .ProbeFailed (paymentId = probePaymentA, paymentHash = probeHashA, shortChannelId = 1uL ))
1409+ onEvent(
1410+ Event .ProbeFailed (
1411+ paymentId = probePaymentA,
1412+ paymentHash = probeHashA,
1413+ shortChannelId = 1uL ,
1414+ routeFeeMsat = 123uL ,
1415+ )
1416+ )
13791417
13801418 val result = async { sut.waitForProbeOutcome(setOf (probePaymentA, probePaymentB)) }
1381- onEvent(Event .ProbeFailed (paymentId = probePaymentB, paymentHash = probeHashB, shortChannelId = 2uL ))
1419+ onEvent(
1420+ Event .ProbeFailed (
1421+ paymentId = probePaymentB,
1422+ paymentHash = probeHashB,
1423+ shortChannelId = 2uL ,
1424+ routeFeeMsat = 456uL ,
1425+ )
1426+ )
13821427
13831428 val outcome = result.await().getOrThrow()
13841429 assertIs<ProbeOutcome .Failure >(outcome)
13851430 assertEquals(probePaymentB, outcome.paymentId)
1386- assertEquals(2uL , outcome.shortChannelId)
1431+ assertEquals(" 2" , outcome.shortChannelId)
1432+ assertEquals(456uL , outcome.routeFeeMsat)
13871433 }
13881434
13891435 @Test
@@ -1400,7 +1446,7 @@ class LightningRepoTest : BaseUnitTest() {
14001446 fun `stop clears probe cache` () = test {
14011447 val onEvent = startNodeAndCaptureEvents()
14021448 whenever(lightningService.stop()).thenReturn(Unit )
1403- onEvent(Event .ProbeSuccessful (paymentId = probePaymentA, paymentHash = probeHashA))
1449+ onEvent(Event .ProbeSuccessful (paymentId = probePaymentA, paymentHash = probeHashA, routeFeeMsat = null ))
14041450
14051451 sut.stop()
14061452 val result = sut.waitForProbeOutcome(setOf (probePaymentA), timeout = 1 .seconds)
0 commit comments