htlcswitch/test: stricter error check in TestSwitchSendPayment

This commit is contained in:
Joost Jager 2019-05-06 15:05:14 +02:00
parent 569f821142
commit 55bef96cf3
No known key found for this signature in database
GPG Key ID: A61B9D4C393C59C7

@ -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")