From 026753bce4c05e9abb5cd6f59073aedc50529ce8 Mon Sep 17 00:00:00 2001 From: Olaoluwa Osuntokun Date: Tue, 21 Feb 2017 00:26:28 -0800 Subject: [PATCH] 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. --- lnd_test.go | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/lnd_test.go b/lnd_test.go index c0983d92..cae397c0 100644 --- a/lnd_test.go +++ b/lnd_test.go @@ -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