From 55bef96cf3f883a7f35253b9bff6d10da4f7d408 Mon Sep 17 00:00:00 2001 From: Joost Jager Date: Mon, 6 May 2019 15:05:14 +0200 Subject: [PATCH] htlcswitch/test: stricter error check in TestSwitchSendPayment --- htlcswitch/switch_test.go | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/htlcswitch/switch_test.go b/htlcswitch/switch_test.go index 6a0a24e9..2571342a 100644 --- a/htlcswitch/switch_test.go +++ b/htlcswitch/switch_test.go @@ -6,7 +6,6 @@ import ( "fmt" "io" "io/ioutil" - "strings" "testing" "time" @@ -1825,9 +1824,13 @@ func TestSwitchSendPayment(t *testing.T) { select { case err := <-errChan: - if !strings.Contains(err.Error(), lnwire.CodeUnknownPaymentHash.String()) { - t.Fatalf("expected %v got %v", err, - lnwire.CodeUnknownPaymentHash) + fErr, ok := err.(*ForwardingError) + if !ok { + t.Fatal("expected ForwardingError") + } + + if _, ok := fErr.FailureMessage.(*lnwire.FailUnknownPaymentHash); !ok { + t.Fatalf("expected UnknownPaymentHash got %v", fErr) } case <-time.After(time.Second): t.Fatal("err wasn't received")