@@ -357,8 +357,11 @@ func runLocalClaimOutgoingHTLC(ht *lntest.HarnessTest,
357
357
// We'll create two random payment hashes unknown to carol, then send
358
358
// each of them by manually specifying the HTLC details.
359
359
carolPubKey := carol .PubKey [:]
360
- dustPayHash := ht .Random32Bytes ()
361
- payHash := ht .Random32Bytes ()
360
+
361
+ preimageDust := ht .RandomPreimage ()
362
+ preimage := ht .RandomPreimage ()
363
+ dustPayHash := preimageDust .Hash ()
364
+ payHash := preimage .Hash ()
362
365
363
366
// If this is a taproot channel, then we'll need to make some manual
364
367
// route hints so Alice can actually find a route.
@@ -370,7 +373,7 @@ func runLocalClaimOutgoingHTLC(ht *lntest.HarnessTest,
370
373
req := & routerrpc.SendPaymentRequest {
371
374
Dest : carolPubKey ,
372
375
Amt : int64 (dustHtlcAmt ),
373
- PaymentHash : dustPayHash ,
376
+ PaymentHash : dustPayHash [:] ,
374
377
FinalCltvDelta : finalCltvDelta ,
375
378
FeeLimitMsat : noFeeLimitMsat ,
376
379
RouteHints : routeHints ,
@@ -380,7 +383,7 @@ func runLocalClaimOutgoingHTLC(ht *lntest.HarnessTest,
380
383
req = & routerrpc.SendPaymentRequest {
381
384
Dest : carolPubKey ,
382
385
Amt : int64 (htlcAmt ),
383
- PaymentHash : payHash ,
386
+ PaymentHash : payHash [:] ,
384
387
FinalCltvDelta : finalCltvDelta ,
385
388
FeeLimitMsat : noFeeLimitMsat ,
386
389
RouteHints : routeHints ,
@@ -530,6 +533,25 @@ func runLocalClaimOutgoingHTLC(ht *lntest.HarnessTest,
530
533
// Once this transaction has been confirmed, Bob should detect that he
531
534
// no longer has any pending channels.
532
535
ht .AssertNumPendingForceClose (bob , 0 )
536
+
537
+ // Now that Bob has claimed his HTLCs, Alice should mark the two
538
+ // payments as failed.
539
+ //
540
+ // Alice will mark this payment as failed with no route as the only
541
+ // route she has is Alice->Bob->Carol. This won't be the case if she
542
+ // has a second route, as another attempt will be tried.
543
+ //
544
+ // TODO(yy): we should instead mark this payment as timed out if she has
545
+ // a second route to try this payment, which is the timeout set by Alice
546
+ // when sending the payment.
547
+ expectedReason := lnrpc .PaymentFailureReason_FAILURE_REASON_NO_ROUTE
548
+ p := ht .AssertPaymentFailureReason (alice , preimage , expectedReason )
549
+ require .Equal (ht , lnrpc .Failure_PERMANENT_CHANNEL_FAILURE ,
550
+ p .Htlcs [0 ].Failure .Code )
551
+
552
+ p = ht .AssertPaymentFailureReason (alice , preimageDust , expectedReason )
553
+ require .Equal (ht , lnrpc .Failure_PERMANENT_CHANNEL_FAILURE ,
554
+ p .Htlcs [0 ].Failure .Code )
533
555
}
534
556
535
557
// testMultiHopReceiverPreimageClaimAnchor tests
0 commit comments