@@ -1348,67 +1348,113 @@ class LightningRepoTest : BaseUnitTest() {
13481348 val onEvent = startNodeAndCaptureEvents()
13491349
13501350 val result = async { sut.waitForProbeOutcome(setOf (probePaymentA)) }
1351- onEvent(Event .ProbeSuccessful (paymentId = probePaymentA, paymentHash = probeHashA))
1351+ onEvent(Event .ProbeSuccessful (paymentId = probePaymentA, paymentHash = probeHashA, routeFeeMsat = 123uL ))
13521352
13531353 val outcome = result.await().getOrThrow()
13541354 assertIs<ProbeOutcome .Success >(outcome)
13551355 assertEquals(probePaymentA, outcome.paymentId)
13561356 assertEquals(probeHashA, outcome.paymentHash)
1357+ assertEquals(123uL , outcome.routeFeeMsat)
13571358 }
13581359
13591360 @Test
13601361 fun `waitForProbeOutcome returns cached success when event arrives before wait` () = test {
13611362 val onEvent = startNodeAndCaptureEvents()
1362- onEvent(Event .ProbeSuccessful (paymentId = probePaymentA, paymentHash = probeHashA))
1363+ onEvent(Event .ProbeSuccessful (paymentId = probePaymentA, paymentHash = probeHashA, routeFeeMsat = 123uL ))
13631364
13641365 val outcome = sut.waitForProbeOutcome(setOf (probePaymentA)).getOrThrow()
13651366
13661367 assertIs<ProbeOutcome .Success >(outcome)
13671368 assertEquals(probePaymentA, outcome.paymentId)
13681369 assertEquals(probeHashA, outcome.paymentHash)
1370+ assertEquals(123uL , outcome.routeFeeMsat)
13691371 }
13701372
13711373 @Test
13721374 fun `waitForProbeOutcome returns last failure only after all tracked probes fail` () = test {
13731375 val onEvent = startNodeAndCaptureEvents()
13741376 val result = async { sut.waitForProbeOutcome(setOf (probePaymentA, probePaymentB)) }
13751377
1376- onEvent(Event .ProbeFailed (paymentId = probePaymentA, paymentHash = probeHashA, shortChannelId = 1uL ))
1377- onEvent(Event .ProbeFailed (paymentId = probePaymentB, paymentHash = probeHashB, shortChannelId = 2uL ))
1378+ onEvent(
1379+ Event .ProbeFailed (
1380+ paymentId = probePaymentA,
1381+ paymentHash = probeHashA,
1382+ shortChannelId = 1uL ,
1383+ routeFeeMsat = 123uL ,
1384+ )
1385+ )
1386+ onEvent(
1387+ Event .ProbeFailed (
1388+ paymentId = probePaymentB,
1389+ paymentHash = probeHashB,
1390+ shortChannelId = 990_718_250_873_192_449uL ,
1391+ routeFeeMsat = 456uL ,
1392+ )
1393+ )
13781394
13791395 val outcome = result.await().getOrThrow()
13801396 assertIs<ProbeOutcome .Failure >(outcome)
13811397 assertEquals(probePaymentB, outcome.paymentId)
13821398 assertEquals(probeHashB, outcome.paymentHash)
1383- assertEquals(2uL , outcome.shortChannelId)
1399+ assertEquals(" 990718250873192449" , outcome.shortChannelId)
1400+ assertEquals(456uL , outcome.routeFeeMsat)
13841401 }
13851402
13861403 @Test
13871404 fun `waitForProbeOutcome returns first success even when another path already failed` () = test {
13881405 val onEvent = startNodeAndCaptureEvents()
13891406 val result = async { sut.waitForProbeOutcome(setOf (probePaymentA, probePaymentB)) }
13901407
1391- onEvent(Event .ProbeFailed (paymentId = probePaymentA, paymentHash = probeHashA, shortChannelId = 1uL ))
1392- onEvent(Event .ProbeSuccessful (paymentId = probePaymentB, paymentHash = probeHashB))
1408+ onEvent(
1409+ Event .ProbeFailed (
1410+ paymentId = probePaymentA,
1411+ paymentHash = probeHashA,
1412+ shortChannelId = 1uL ,
1413+ routeFeeMsat = 123uL ,
1414+ )
1415+ )
1416+ onEvent(
1417+ Event .ProbeSuccessful (
1418+ paymentId = probePaymentB,
1419+ paymentHash = probeHashB,
1420+ routeFeeMsat = 456uL ,
1421+ )
1422+ )
13931423
13941424 val outcome = result.await().getOrThrow()
13951425 assertIs<ProbeOutcome .Success >(outcome)
13961426 assertEquals(probePaymentB, outcome.paymentId)
13971427 assertEquals(probeHashB, outcome.paymentHash)
1428+ assertEquals(456uL , outcome.routeFeeMsat)
13981429 }
13991430
14001431 @Test
14011432 fun `waitForProbeOutcome does not hang on partial cached failures` () = test {
14021433 val onEvent = startNodeAndCaptureEvents()
1403- onEvent(Event .ProbeFailed (paymentId = probePaymentA, paymentHash = probeHashA, shortChannelId = 1uL ))
1434+ onEvent(
1435+ Event .ProbeFailed (
1436+ paymentId = probePaymentA,
1437+ paymentHash = probeHashA,
1438+ shortChannelId = 1uL ,
1439+ routeFeeMsat = 123uL ,
1440+ )
1441+ )
14041442
14051443 val result = async { sut.waitForProbeOutcome(setOf (probePaymentA, probePaymentB)) }
1406- onEvent(Event .ProbeFailed (paymentId = probePaymentB, paymentHash = probeHashB, shortChannelId = 2uL ))
1444+ onEvent(
1445+ Event .ProbeFailed (
1446+ paymentId = probePaymentB,
1447+ paymentHash = probeHashB,
1448+ shortChannelId = 2uL ,
1449+ routeFeeMsat = 456uL ,
1450+ )
1451+ )
14071452
14081453 val outcome = result.await().getOrThrow()
14091454 assertIs<ProbeOutcome .Failure >(outcome)
14101455 assertEquals(probePaymentB, outcome.paymentId)
1411- assertEquals(2uL , outcome.shortChannelId)
1456+ assertEquals(" 2" , outcome.shortChannelId)
1457+ assertEquals(456uL , outcome.routeFeeMsat)
14121458 }
14131459
14141460 @Test
@@ -1425,7 +1471,7 @@ class LightningRepoTest : BaseUnitTest() {
14251471 fun `stop clears probe cache` () = test {
14261472 val onEvent = startNodeAndCaptureEvents()
14271473 whenever(lightningService.stop()).thenReturn(Unit )
1428- onEvent(Event .ProbeSuccessful (paymentId = probePaymentA, paymentHash = probeHashA))
1474+ onEvent(Event .ProbeSuccessful (paymentId = probePaymentA, paymentHash = probeHashA, routeFeeMsat = null ))
14291475
14301476 sut.stop()
14311477 val result = sut.waitForProbeOutcome(setOf (probePaymentA), timeout = 1 .seconds)
0 commit comments