From 4c74c0817e7a3e75f8f3de02bd790c7f0854cb6b Mon Sep 17 00:00:00 2001 From: Joost Jager Date: Thu, 20 Feb 2020 14:56:24 +0100 Subject: [PATCH] channeldb/test: extend payment control test with failed attempt --- channeldb/payment_control_test.go | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/channeldb/payment_control_test.go b/channeldb/payment_control_test.go index 5272ec79a..063a2e6f5 100644 --- a/channeldb/payment_control_test.go +++ b/channeldb/payment_control_test.go @@ -116,9 +116,18 @@ func TestPaymentControlSwitchFail(t *testing.T) { nil, ) - // Record a new attempt. + // Record a new attempt. In this test scenario, the attempt fails. + // However, this is not communicated to control tower in the current + // implementation. It only registers the initiation of the attempt. attempt.AttemptID = 2 err = pControl.RegisterAttempt(info.PaymentHash, attempt) + if err != nil { + t.Fatalf("unable to register attempt: %v", err) + } + + // Record another attempt. + attempt.AttemptID = 3 + err = pControl.RegisterAttempt(info.PaymentHash, attempt) if err != nil { t.Fatalf("unable to send htlc message: %v", err) } @@ -128,7 +137,7 @@ func TestPaymentControlSwitchFail(t *testing.T) { nil, ) - // Verifies that status was changed to StatusSucceeded. + // Settle the attempt and verify that status was changed to StatusSucceeded. var payment *MPPayment payment, err = pControl.Success(info.PaymentHash, preimg) if err != nil {