@@ -1396,3 +1396,48 @@ func testSendPaymentKeysendMPPFail(ht *lntest.HarnessTest) {
1396
1396
_ , err = ht .ReceivePaymentUpdate (client )
1397
1397
require .Error (ht , err )
1398
1398
}
1399
+
1400
+ // testSendPaymentWithRouteHints tests sending a payment using route hints
1401
+ // derived from a private channel.
1402
+ func testSendPaymentWithRouteHints (ht * lntest.HarnessTest ) {
1403
+ // Setup a three-node network: Alice -> Bob -> Carol.
1404
+ alice := ht .NewNode ("Alice" , nil )
1405
+ defer ht .Shutdown (alice )
1406
+ bob := ht .NewNode ("Bob" , nil )
1407
+ defer ht .Shutdown (bob )
1408
+ carol := ht .NewNode ("Carol" , nil )
1409
+ defer ht .Shutdown (carol )
1410
+
1411
+ ht .ConnectNodes (alice , bob )
1412
+ ht .ConnectNodes (bob , carol )
1413
+
1414
+ // Fund Alice and Bob.
1415
+ ht .FundCoins (btcutil .SatoshiPerBitcoin , alice )
1416
+ ht .FundCoins (btcutil .SatoshiPerBitcoin , bob )
1417
+
1418
+ // Open channels: Alice -> Bob (public), Bob -> Carol (private).
1419
+ const chanAmt = btcutil .Amount (1_000_000 )
1420
+ aliceBobChanPoint := ht .OpenChannel (
1421
+ alice , bob , lntest.OpenChannelParams {Amt : chanAmt },
1422
+ )
1423
+ defer ht .CloseChannel (alice , aliceBobChanPoint )
1424
+ bobCarolChanPoint := ht .OpenChannel (
1425
+ bob , carol , lntest.OpenChannelParams {Amt : chanAmt , Private : true },
1426
+ )
1427
+ defer ht .CloseChannel (bob , bobCarolChanPoint )
1428
+
1429
+ sendReq := & routerrpc.SendPaymentRequest {
1430
+ PaymentRequest : carol .RPC .AddInvoice (& lnrpc.Invoice {
1431
+ Value : 10_000 ,
1432
+ Private : true , // include route hints
1433
+ }).PaymentRequest ,
1434
+ FeeLimitSat : int64 (chanAmt ),
1435
+ TimeoutSeconds : 60 ,
1436
+ }
1437
+
1438
+ // Send payment and assert success.
1439
+ ht .AssertPaymentStatusFromStream (
1440
+ alice .RPC .SendPayment (sendReq ),
1441
+ lnrpc .Payment_SUCCEEDED ,
1442
+ )
1443
+ }
0 commit comments