channeldb+routing: store full htlc failure reason

This commit extends the htlc fail info with the full failure reason that
was received over the wire. In a later commit, this info will also be
exposed on the rpc interface. Furthermore it serves as a building block
to make SendToRoute reliable across restarts.
This commit is contained in:
Joost Jager
2020-02-20 18:08:01 +01:00
parent 48c0e42c26
commit f86e68a1a2
3 changed files with 134 additions and 10 deletions

View File

@@ -126,7 +126,9 @@ func TestPaymentControlSwitchFail(t *testing.T) {
}
err = pControl.FailAttempt(
info.PaymentHash, 2, &HTLCFailInfo{},
info.PaymentHash, 2, &HTLCFailInfo{
Reason: HTLCFailUnreadable,
},
)
if err != nil {
t.Fatal(err)
@@ -362,7 +364,9 @@ func TestPaymentControlDeleteNonInFligt(t *testing.T) {
// Fail the payment attempt.
err := pControl.FailAttempt(
info.PaymentHash, attempt.AttemptID,
&HTLCFailInfo{},
&HTLCFailInfo{
Reason: HTLCFailUnreadable,
},
)
if err != nil {
t.Fatalf("unable to fail htlc: %v", err)