diff --git a/lntest/itest/lnd_test.go b/lntest/itest/lnd_test.go index 4e1b26a4..94358536 100644 --- a/lntest/itest/lnd_test.go +++ b/lntest/itest/lnd_test.go @@ -3826,12 +3826,19 @@ func testListPayments(net *lntest.NetworkHarness, t *harnessTest) { p.PaymentHash, correctRHash) } - // Finally, as we made a single-hop direct payment, there should have - // been no fee applied. + // As we made a single-hop direct payment, there should have been no fee + // applied. if p.Fee != 0 { t.Fatalf("incorrect Fee, got %v, want %v", p.Fee, 0) } + // Finally, verify that the payment request returned by the rpc matches + // the invoice that we paid. + if p.PaymentRequest != invoiceResp.PaymentRequest { + t.Fatalf("incorrect payreq, got: %v, want: %v", + p.PaymentRequest, invoiceResp.PaymentRequest) + } + // Delete all payments from Alice. DB should have no payments. delReq := &lnrpc.DeleteAllPaymentsRequest{} ctxt, _ = context.WithTimeout(ctxt, defaultTimeout) @@ -4357,6 +4364,26 @@ func testSingleHopSendToRoute(net *lntest.NetworkHarness, t *harnessTest) { } } + req := &lnrpc.ListPaymentsRequest{} + ctxt, _ = context.WithTimeout(ctxt, defaultTimeout) + paymentsResp, err := net.Alice.ListPayments(ctxt, req) + if err != nil { + t.Fatalf("error when obtaining Alice payments: %v", err) + } + if len(paymentsResp.Payments) != 5 { + t.Fatalf("incorrect number of payments, got %v, want %v", + len(paymentsResp.Payments), 5) + } + + // Verify that the ListPayments displays the payment without an invoice + // since the payment was completed with SendToRoute. + for _, p := range paymentsResp.Payments { + if p.PaymentRequest != "" { + t.Fatalf("incorrect payreq, want: \"\", got: %v", + p.PaymentRequest) + } + } + // At this point all the channels within our proto network should be // shifted by 5k satoshis in the direction of Bob, the sink within the // payment flow generated above. The order of asserts corresponds to