mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-08-25 13:12:11 +02:00
paymentsdb: rename assertPaymentstatus
This commit is contained in:
@@ -105,7 +105,7 @@ func TestKVPaymentsDBDeleteNonInFlight(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Verify the status is indeed Failed.
|
// Verify the status is indeed Failed.
|
||||||
assertPaymentstatus(
|
assertDBPaymentstatus(
|
||||||
t, paymentDB, info.PaymentIdentifier,
|
t, paymentDB, info.PaymentIdentifier,
|
||||||
StatusFailed,
|
StatusFailed,
|
||||||
)
|
)
|
||||||
@@ -129,7 +129,7 @@ func TestKVPaymentsDBDeleteNonInFlight(t *testing.T) {
|
|||||||
" got: %v", err)
|
" got: %v", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
assertPaymentstatus(
|
assertDBPaymentstatus(
|
||||||
t, paymentDB, info.PaymentIdentifier,
|
t, paymentDB, info.PaymentIdentifier,
|
||||||
StatusSucceeded,
|
StatusSucceeded,
|
||||||
)
|
)
|
||||||
@@ -143,7 +143,7 @@ func TestKVPaymentsDBDeleteNonInFlight(t *testing.T) {
|
|||||||
numSuccess++
|
numSuccess++
|
||||||
|
|
||||||
default:
|
default:
|
||||||
assertPaymentstatus(
|
assertDBPaymentstatus(
|
||||||
t, paymentDB, info.PaymentIdentifier,
|
t, paymentDB, info.PaymentIdentifier,
|
||||||
StatusInFlight,
|
StatusInFlight,
|
||||||
)
|
)
|
||||||
|
@@ -271,9 +271,9 @@ func assertPaymentInfo(t *testing.T, p DB, hash lntypes.Hash,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// assertPaymentstatus retrieves the status of the payment referred to by hash
|
// assertDBPaymentstatus retrieves the status of the payment referred to by hash
|
||||||
// and compares it with the expected state.
|
// and compares it with the expected state.
|
||||||
func assertPaymentstatus(t *testing.T, p DB, hash lntypes.Hash,
|
func assertDBPaymentstatus(t *testing.T, p DB, hash lntypes.Hash,
|
||||||
expStatus PaymentStatus) {
|
expStatus PaymentStatus) {
|
||||||
|
|
||||||
t.Helper()
|
t.Helper()
|
||||||
@@ -1292,7 +1292,7 @@ func TestSwitchDoubleSend(t *testing.T) {
|
|||||||
require.NoError(t, err, "unable to send htlc message")
|
require.NoError(t, err, "unable to send htlc message")
|
||||||
|
|
||||||
assertPaymentIndex(t, paymentDB, info.PaymentIdentifier)
|
assertPaymentIndex(t, paymentDB, info.PaymentIdentifier)
|
||||||
assertPaymentstatus(
|
assertDBPaymentstatus(
|
||||||
t, paymentDB, info.PaymentIdentifier, StatusInitiated,
|
t, paymentDB, info.PaymentIdentifier, StatusInitiated,
|
||||||
)
|
)
|
||||||
assertPaymentInfo(
|
assertPaymentInfo(
|
||||||
@@ -1308,7 +1308,7 @@ func TestSwitchDoubleSend(t *testing.T) {
|
|||||||
// Record an attempt.
|
// Record an attempt.
|
||||||
_, err = paymentDB.RegisterAttempt(info.PaymentIdentifier, attempt)
|
_, err = paymentDB.RegisterAttempt(info.PaymentIdentifier, attempt)
|
||||||
require.NoError(t, err, "unable to send htlc message")
|
require.NoError(t, err, "unable to send htlc message")
|
||||||
assertPaymentstatus(
|
assertDBPaymentstatus(
|
||||||
t, paymentDB, info.PaymentIdentifier, StatusInFlight,
|
t, paymentDB, info.PaymentIdentifier, StatusInFlight,
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -1334,7 +1334,7 @@ func TestSwitchDoubleSend(t *testing.T) {
|
|||||||
},
|
},
|
||||||
)
|
)
|
||||||
require.NoError(t, err, "error shouldn't have been received, got")
|
require.NoError(t, err, "error shouldn't have been received, got")
|
||||||
assertPaymentstatus(
|
assertDBPaymentstatus(
|
||||||
t, paymentDB, info.PaymentIdentifier, StatusSucceeded,
|
t, paymentDB, info.PaymentIdentifier, StatusSucceeded,
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -1364,7 +1364,7 @@ func TestSwitchFail(t *testing.T) {
|
|||||||
require.NoError(t, err, "unable to send htlc message")
|
require.NoError(t, err, "unable to send htlc message")
|
||||||
|
|
||||||
assertPaymentIndex(t, paymentDB, info.PaymentIdentifier)
|
assertPaymentIndex(t, paymentDB, info.PaymentIdentifier)
|
||||||
assertPaymentstatus(
|
assertDBPaymentstatus(
|
||||||
t, paymentDB, info.PaymentIdentifier, StatusInitiated,
|
t, paymentDB, info.PaymentIdentifier, StatusInitiated,
|
||||||
)
|
)
|
||||||
assertPaymentInfo(
|
assertPaymentInfo(
|
||||||
@@ -1377,7 +1377,7 @@ func TestSwitchFail(t *testing.T) {
|
|||||||
require.NoError(t, err, "unable to fail payment hash")
|
require.NoError(t, err, "unable to fail payment hash")
|
||||||
|
|
||||||
// Verify the status is indeed Failed.
|
// Verify the status is indeed Failed.
|
||||||
assertPaymentstatus(t, paymentDB, info.PaymentIdentifier, StatusFailed)
|
assertDBPaymentstatus(t, paymentDB, info.PaymentIdentifier, StatusFailed)
|
||||||
assertPaymentInfo(
|
assertPaymentInfo(
|
||||||
t, paymentDB, info.PaymentIdentifier, info, &failReason, nil,
|
t, paymentDB, info.PaymentIdentifier, info, &failReason, nil,
|
||||||
)
|
)
|
||||||
@@ -1397,7 +1397,7 @@ func TestSwitchFail(t *testing.T) {
|
|||||||
assertPaymentIndex(t, paymentDB, info.PaymentIdentifier)
|
assertPaymentIndex(t, paymentDB, info.PaymentIdentifier)
|
||||||
assertNoIndex(t, paymentDB, payment.SequenceNum)
|
assertNoIndex(t, paymentDB, payment.SequenceNum)
|
||||||
|
|
||||||
assertPaymentstatus(
|
assertDBPaymentstatus(
|
||||||
t, paymentDB, info.PaymentIdentifier, StatusInitiated,
|
t, paymentDB, info.PaymentIdentifier, StatusInitiated,
|
||||||
)
|
)
|
||||||
assertPaymentInfo(
|
assertPaymentInfo(
|
||||||
@@ -1420,7 +1420,7 @@ func TestSwitchFail(t *testing.T) {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
assertPaymentstatus(
|
assertDBPaymentstatus(
|
||||||
t, paymentDB, info.PaymentIdentifier, StatusInFlight,
|
t, paymentDB, info.PaymentIdentifier, StatusInFlight,
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -1435,7 +1435,7 @@ func TestSwitchFail(t *testing.T) {
|
|||||||
attempt.AttemptID = 1
|
attempt.AttemptID = 1
|
||||||
_, err = paymentDB.RegisterAttempt(info.PaymentIdentifier, attempt)
|
_, err = paymentDB.RegisterAttempt(info.PaymentIdentifier, attempt)
|
||||||
require.NoError(t, err, "unable to send htlc message")
|
require.NoError(t, err, "unable to send htlc message")
|
||||||
assertPaymentstatus(
|
assertDBPaymentstatus(
|
||||||
t, paymentDB, info.PaymentIdentifier, StatusInFlight,
|
t, paymentDB, info.PaymentIdentifier, StatusInFlight,
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -1469,7 +1469,7 @@ func TestSwitchFail(t *testing.T) {
|
|||||||
spew.Sdump(payment.HTLCs[0].Route), err)
|
spew.Sdump(payment.HTLCs[0].Route), err)
|
||||||
}
|
}
|
||||||
|
|
||||||
assertPaymentstatus(
|
assertDBPaymentstatus(
|
||||||
t, paymentDB, info.PaymentIdentifier, StatusSucceeded,
|
t, paymentDB, info.PaymentIdentifier, StatusSucceeded,
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -1522,7 +1522,7 @@ func TestMultiShard(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
assertPaymentIndex(t, paymentDB, info.PaymentIdentifier)
|
assertPaymentIndex(t, paymentDB, info.PaymentIdentifier)
|
||||||
assertPaymentstatus(
|
assertDBPaymentstatus(
|
||||||
t, paymentDB, info.PaymentIdentifier, StatusInitiated,
|
t, paymentDB, info.PaymentIdentifier, StatusInitiated,
|
||||||
)
|
)
|
||||||
assertPaymentInfo(
|
assertPaymentInfo(
|
||||||
@@ -1551,7 +1551,7 @@ func TestMultiShard(t *testing.T) {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatalf("unable to send htlc message: %v", err)
|
t.Fatalf("unable to send htlc message: %v", err)
|
||||||
}
|
}
|
||||||
assertPaymentstatus(
|
assertDBPaymentstatus(
|
||||||
t, paymentDB, info.PaymentIdentifier,
|
t, paymentDB, info.PaymentIdentifier,
|
||||||
StatusInFlight,
|
StatusInFlight,
|
||||||
)
|
)
|
||||||
@@ -1595,7 +1595,7 @@ func TestMultiShard(t *testing.T) {
|
|||||||
)
|
)
|
||||||
|
|
||||||
// Payment should still be in-flight.
|
// Payment should still be in-flight.
|
||||||
assertPaymentstatus(
|
assertDBPaymentstatus(
|
||||||
t, paymentDB, info.PaymentIdentifier, StatusInFlight,
|
t, paymentDB, info.PaymentIdentifier, StatusInFlight,
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -1659,7 +1659,7 @@ func TestMultiShard(t *testing.T) {
|
|||||||
|
|
||||||
// The payment is now considered pending fail, since
|
// The payment is now considered pending fail, since
|
||||||
// there is still an active HTLC.
|
// there is still an active HTLC.
|
||||||
assertPaymentstatus(
|
assertDBPaymentstatus(
|
||||||
t, paymentDB, info.PaymentIdentifier,
|
t, paymentDB, info.PaymentIdentifier,
|
||||||
StatusInFlight,
|
StatusInFlight,
|
||||||
)
|
)
|
||||||
@@ -1680,7 +1680,7 @@ func TestMultiShard(t *testing.T) {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
assertPaymentstatus(
|
assertDBPaymentstatus(
|
||||||
t, paymentDB, info.PaymentIdentifier, StatusInFlight,
|
t, paymentDB, info.PaymentIdentifier, StatusInFlight,
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -1763,7 +1763,7 @@ func TestMultiShard(t *testing.T) {
|
|||||||
registerErr = ErrPaymentAlreadySucceeded
|
registerErr = ErrPaymentAlreadySucceeded
|
||||||
}
|
}
|
||||||
|
|
||||||
assertPaymentstatus(
|
assertDBPaymentstatus(
|
||||||
t, paymentDB, info.PaymentIdentifier, finalStatus,
|
t, paymentDB, info.PaymentIdentifier, finalStatus,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user