Merge pull request #3705 from joostjager/payment-fail-log

routing+htlcswitch: improve failed payment logging
This commit is contained in:
Johan T. Halseth authored and GitHub committed 2019-11-15 10:41:48 +01:00
commit d4d8b03d5b
4 files changed
+25 -11

No files matched your search

+6 -2
View File
@@ -30,10 +30,14 @@ type ForwardingError struct {
// returned.
func (f *ForwardingError) Error() string {
if f.ExtraMsg == "" {
return fmt.Sprintf("%v", f.FailureMessage)
return fmt.Sprintf(
"%v@%v", f.FailureMessage, f.FailureSourceIdx,
)
}
return fmt.Sprintf("%v: %v", f.FailureMessage, f.ExtraMsg)
return fmt.Sprintf(
"%v@%v: %v", f.FailureMessage, f.FailureSourceIdx, f.ExtraMsg,
)
}
// ErrorDecrypter is an interface that is used to decrypt the onion encrypted
+8 -2
View File
@@ -1248,8 +1248,14 @@ func TestChannelLinkMultiHopUnknownNextHop(t *testing.T) {
totalTimelock).Wait(30 * time.Second)
if err == nil {
t.Fatal("error haven't been received")
} else if err.Error() != lnwire.CodeUnknownNextPeer.String() {
t.Fatalf("wrong error have been received: %v", err)
}
fErr, ok := err.(*ForwardingError)
if !ok {
t.Fatalf("expected ForwardingError")
}
if _, ok = fErr.FailureMessage.(*lnwire.FailUnknownNextPeer); !ok {
t.Fatalf("wrong error has been received: %T",
fErr.FailureMessage)
}
// Wait for Alice to receive the revocation.