lntest/itest/lnd_test: assert payreq in listpayment matches paid invoice
This commit is contained in:
parent
7960849995
commit
a826d85dac
@ -3826,12 +3826,19 @@ func testListPayments(net *lntest.NetworkHarness, t *harnessTest) {
|
|||||||
p.PaymentHash, correctRHash)
|
p.PaymentHash, correctRHash)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Finally, as we made a single-hop direct payment, there should have
|
// As we made a single-hop direct payment, there should have been no fee
|
||||||
// been no fee applied.
|
// applied.
|
||||||
if p.Fee != 0 {
|
if p.Fee != 0 {
|
||||||
t.Fatalf("incorrect Fee, got %v, want %v", 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.
|
// Delete all payments from Alice. DB should have no payments.
|
||||||
delReq := &lnrpc.DeleteAllPaymentsRequest{}
|
delReq := &lnrpc.DeleteAllPaymentsRequest{}
|
||||||
ctxt, _ = context.WithTimeout(ctxt, defaultTimeout)
|
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
|
// 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
|
// shifted by 5k satoshis in the direction of Bob, the sink within the
|
||||||
// payment flow generated above. The order of asserts corresponds to
|
// payment flow generated above. The order of asserts corresponds to
|
||||||
|
Loading…
Reference in New Issue
Block a user