routing/payment_lifecycle: return recorded errors

In preparation for MPP we return the terminal errors recorded with the
control tower. The reason is that we cannot return immediately when a
shard fails for MPP, since there might be more shards in flight that we
must wait for. For that reason we instead mark the payment failed in the
control tower, then return this error when we inspect the payment,
seeing it has been failed and there are no shards in flight.
This commit is contained in:
Johan T. Halseth committed 2020-04-02 10:24:35 +02:00
1 parent 7b5c10814b
commit 5adfc968df
4 files changed
+72 -59

No files matched your search

+2 -4
View File
@@ -7,7 +7,6 @@ import (
"image/color"
"math"
"math/rand"
"strings"
"sync/atomic"
"testing"
"time"
@@ -792,9 +791,8 @@ func TestSendPaymentErrorPathPruning(t *testing.T) {
// The final error returned should also indicate that the peer wasn't
// online (the last error we returned).
// TODO: proper err code
if !strings.Contains(err.Error(), "unable to find") {
t.Fatalf("expected UnknownNextPeer instead got: %v", err)
if err != channeldb.FailureReasonNoRoute {
t.Fatalf("expected no route instead got: %v", err)
}
// Inspect the two attempts that were made before the payment failed.