Merge pull request #3705 from joostjager/payment-fail-log
routing+htlcswitch: improve failed payment logging
This commit is contained in:
4 files changed
+25
-11
No files matched your search
@@ -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
|
||||
|
||||
@@ -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.
|
||||
|
||||
Reference in new issue
Block a user