mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-07-23 19:35:28 +02:00
htlcswitch: do not consider unknown failures an error
This commit is contained in:
@@ -2344,4 +2344,37 @@ func TestInvalidFailure(t *testing.T) {
|
||||
case <-time.After(time.Second):
|
||||
t.Fatal("err wasn't received")
|
||||
}
|
||||
|
||||
// Modify the decryption to simulate that decryption went alright, but
|
||||
// the failure cannot be decoded.
|
||||
deobfuscator = SphinxErrorDecrypter{
|
||||
OnionErrorDecrypter: &mockOnionErrorDecryptor{
|
||||
sourceIdx: 2,
|
||||
message: []byte{200},
|
||||
},
|
||||
}
|
||||
|
||||
resultChan, err = s.GetPaymentResult(
|
||||
paymentID, rhash, &deobfuscator,
|
||||
)
|
||||
if err != nil {
|
||||
t.Fatal(err)
|
||||
}
|
||||
|
||||
select {
|
||||
case result := <-resultChan:
|
||||
fErr, ok := result.Error.(*ForwardingError)
|
||||
if !ok {
|
||||
t.Fatal("expected ForwardingError")
|
||||
}
|
||||
if fErr.FailureSourceIdx != 2 {
|
||||
t.Fatal("unexpected error source index")
|
||||
}
|
||||
if fErr.FailureMessage != nil {
|
||||
t.Fatal("expected empty failure message")
|
||||
}
|
||||
|
||||
case <-time.After(time.Second):
|
||||
t.Fatal("err wasn't received")
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user