test: add assertion within integration tests for proper preimage after send

In this commit we modify the testSingleHopInvoice test to ensure that
we obtain the proper preimage from the SendPayment RPC upon successful
payment completion.
This commit is contained in:
Olaoluwa Osuntokun 2017-02-21 00:26:28 -08:00
parent 250c763c76
commit 026753bce4
No known key found for this signature in database
GPG Key ID: 9CC5B105D03521A2

@ -571,9 +571,16 @@ func testSingleHopInvoice(net *networkHarness, t *harnessTest) {
if err := sendStream.Send(sendReq); err != nil {
t.Fatalf("unable to send payment: %v", err)
}
if _, err := sendStream.Recv(); err != nil {
// Ensure we obtain the proper preimage in the response.
resp, err := sendStream.Recv()
if err != nil {
t.Fatalf("error when attempting recv: %v", err)
}
if !bytes.Equal(preimage, resp.PaymentPreimage) {
t.Fatalf("preimage mismatch: expected %v, got %v", preimage,
resp.PaymentPreimage)
}
// Bob's invoice should now be found and marked as settled.
// TODO(roasbeef): remove sleep after hooking into the to-be-written