multi: fix linter issues
This commit is contained in:
3 files changed
+66
-31
No files matched your search
@@ -137,6 +137,7 @@ var (
|
|||||||
"does not exist")
|
"does not exist")
|
||||||
)
|
)
|
||||||
|
|
||||||
|
//nolint:ll
|
||||||
var (
|
var (
|
||||||
// paymentsRootBucket is the name of the top-level bucket within the
|
// paymentsRootBucket is the name of the top-level bucket within the
|
||||||
// database that stores all data related to payments. Within this
|
// database that stores all data related to payments. Within this
|
||||||
@@ -347,7 +348,7 @@ func (p *KVPaymentsDB) InitPayment(paymentHash lntypes.Hash,
|
|||||||
// are initializing a payment that was attempted earlier, but
|
// are initializing a payment that was attempted earlier, but
|
||||||
// left in a state where we could retry.
|
// left in a state where we could retry.
|
||||||
err = bucket.DeleteNestedBucket(paymentHtlcsBucket)
|
err = bucket.DeleteNestedBucket(paymentHtlcsBucket)
|
||||||
if err != nil && err != kvdb.ErrBucketNotFound {
|
if err != nil && !errors.Is(err, kvdb.ErrBucketNotFound) {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -372,6 +373,7 @@ func (p *KVPaymentsDB) DeleteFailedAttempts(hash lntypes.Hash) error {
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -395,6 +397,7 @@ func createPaymentIndexEntry(tx kvdb.RwTx, sequenceNumber []byte,
|
|||||||
}
|
}
|
||||||
|
|
||||||
indexes := tx.ReadWriteBucket(paymentsIndexBucket)
|
indexes := tx.ReadWriteBucket(paymentsIndexBucket)
|
||||||
|
|
||||||
return indexes.Put(sequenceNumber, b.Bytes())
|
return indexes.Put(sequenceNumber, b.Bytes())
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -562,6 +565,7 @@ func (p *KVPaymentsDB) RegisterAttempt(paymentHash lntypes.Hash,
|
|||||||
|
|
||||||
// Retrieve attempt info for the notification.
|
// Retrieve attempt info for the notification.
|
||||||
payment, err = fetchPayment(bucket)
|
payment, err = fetchPayment(bucket)
|
||||||
|
|
||||||
return err
|
return err
|
||||||
})
|
})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@@ -637,17 +641,20 @@ func (p *KVPaymentsDB) updateHtlcKey(paymentHash lntypes.Hash,
|
|||||||
return fmt.Errorf("htlcs bucket not found")
|
return fmt.Errorf("htlcs bucket not found")
|
||||||
}
|
}
|
||||||
|
|
||||||
if htlcsBucket.Get(htlcBucketKey(htlcAttemptInfoKey, aid)) == nil {
|
attemptKey := htlcBucketKey(htlcAttemptInfoKey, aid)
|
||||||
|
if htlcsBucket.Get(attemptKey) == nil {
|
||||||
return fmt.Errorf("HTLC with ID %v not registered",
|
return fmt.Errorf("HTLC with ID %v not registered",
|
||||||
attemptID)
|
attemptID)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Make sure the shard is not already failed or settled.
|
// Make sure the shard is not already failed or settled.
|
||||||
if htlcsBucket.Get(htlcBucketKey(htlcFailInfoKey, aid)) != nil {
|
failKey := htlcBucketKey(htlcFailInfoKey, aid)
|
||||||
|
if htlcsBucket.Get(failKey) != nil {
|
||||||
return ErrAttemptAlreadyFailed
|
return ErrAttemptAlreadyFailed
|
||||||
}
|
}
|
||||||
|
|
||||||
if htlcsBucket.Get(htlcBucketKey(htlcSettleInfoKey, aid)) != nil {
|
settleKey := htlcBucketKey(htlcSettleInfoKey, aid)
|
||||||
|
if htlcsBucket.Get(settleKey) != nil {
|
||||||
return ErrAttemptAlreadySettled
|
return ErrAttemptAlreadySettled
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -659,6 +666,7 @@ func (p *KVPaymentsDB) updateHtlcKey(paymentHash lntypes.Hash,
|
|||||||
|
|
||||||
// Retrieve attempt info for the notification.
|
// Retrieve attempt info for the notification.
|
||||||
payment, err = fetchPayment(bucket)
|
payment, err = fetchPayment(bucket)
|
||||||
|
|
||||||
return err
|
return err
|
||||||
})
|
})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@@ -687,7 +695,7 @@ func (p *KVPaymentsDB) Fail(paymentHash lntypes.Hash,
|
|||||||
|
|
||||||
prefetchPayment(tx, paymentHash)
|
prefetchPayment(tx, paymentHash)
|
||||||
bucket, err := fetchPaymentBucketUpdate(tx, paymentHash)
|
bucket, err := fetchPaymentBucketUpdate(tx, paymentHash)
|
||||||
if err == ErrPaymentNotInitiated {
|
if errors.Is(err, ErrPaymentNotInitiated) {
|
||||||
updateErr = ErrPaymentNotInitiated
|
updateErr = ErrPaymentNotInitiated
|
||||||
return nil
|
return nil
|
||||||
} else if err != nil {
|
} else if err != nil {
|
||||||
@@ -802,7 +810,6 @@ func fetchPaymentBucket(tx kvdb.RTx, paymentHash lntypes.Hash) (
|
|||||||
}
|
}
|
||||||
|
|
||||||
return bucket, nil
|
return bucket, nil
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// fetchPaymentBucketUpdate is identical to fetchPaymentBucket, but it returns a
|
// fetchPaymentBucketUpdate is identical to fetchPaymentBucket, but it returns a
|
||||||
@@ -843,6 +850,7 @@ func (p *KVPaymentsDB) nextPaymentSequence() ([]byte, error) {
|
|||||||
|
|
||||||
currPaymentSeq = paymentsBucket.Sequence()
|
currPaymentSeq = paymentsBucket.Sequence()
|
||||||
newUpperBound = currPaymentSeq + paymentSeqBlockSize
|
newUpperBound = currPaymentSeq + paymentSeqBlockSize
|
||||||
|
|
||||||
return paymentsBucket.SetSequence(newUpperBound)
|
return paymentsBucket.SetSequence(newUpperBound)
|
||||||
}, func() {}); err != nil {
|
}, func() {}); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
@@ -928,6 +936,7 @@ func (p *KVPaymentsDB) FetchInFlightPayments() ([]*MPPayment, error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
inFlights = append(inFlights, p)
|
inFlights = append(inFlights, p)
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
})
|
})
|
||||||
}, func() {
|
}, func() {
|
||||||
@@ -952,12 +961,11 @@ func htlcBucketKey(prefix, id []byte) []byte {
|
|||||||
key := make([]byte, len(prefix)+len(id))
|
key := make([]byte, len(prefix)+len(id))
|
||||||
copy(key, prefix)
|
copy(key, prefix)
|
||||||
copy(key[len(prefix):], id)
|
copy(key[len(prefix):], id)
|
||||||
|
|
||||||
return key
|
return key
|
||||||
}
|
}
|
||||||
|
|
||||||
// FetchPayments returns all sent payments found in the DB.
|
// FetchPayments returns all sent payments found in the DB.
|
||||||
//
|
|
||||||
// nolint: dupl
|
|
||||||
func (p *KVPaymentsDB) FetchPayments() ([]*MPPayment, error) {
|
func (p *KVPaymentsDB) FetchPayments() ([]*MPPayment, error) {
|
||||||
var payments []*MPPayment
|
var payments []*MPPayment
|
||||||
|
|
||||||
@@ -993,6 +1001,7 @@ func (p *KVPaymentsDB) FetchPayments() ([]*MPPayment, error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
payments = append(payments, duplicatePayments...)
|
payments = append(payments, duplicatePayments...)
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
})
|
})
|
||||||
}, func() {
|
}, func() {
|
||||||
@@ -1017,6 +1026,7 @@ func fetchCreationInfo(bucket kvdb.RBucket) (*PaymentCreationInfo, error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
r := bytes.NewReader(b)
|
r := bytes.NewReader(b)
|
||||||
|
|
||||||
return deserializePaymentCreationInfo(r)
|
return deserializePaymentCreationInfo(r)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1196,7 +1206,9 @@ func fetchFailedHtlcKeys(bucket kvdb.RBucket) ([][]byte, error) {
|
|||||||
// QueryPayments is a query to the payments database which is restricted
|
// QueryPayments is a query to the payments database which is restricted
|
||||||
// to a subset of payments by the payments query, containing an offset
|
// to a subset of payments by the payments query, containing an offset
|
||||||
// index and a maximum number of returned payments.
|
// index and a maximum number of returned payments.
|
||||||
func (p *KVPaymentsDB) QueryPayments(query PaymentsQuery) (PaymentsResponse, error) {
|
func (p *KVPaymentsDB) QueryPayments(query PaymentsQuery) (PaymentsResponse,
|
||||||
|
error) {
|
||||||
|
|
||||||
var resp PaymentsResponse
|
var resp PaymentsResponse
|
||||||
|
|
||||||
if err := kvdb.View(p.db, func(tx kvdb.RTx) error {
|
if err := kvdb.View(p.db, func(tx kvdb.RTx) error {
|
||||||
@@ -1263,6 +1275,7 @@ func (p *KVPaymentsDB) QueryPayments(query PaymentsQuery) (PaymentsResponse, err
|
|||||||
// At this point, we've exhausted the offset, so we'll
|
// At this point, we've exhausted the offset, so we'll
|
||||||
// begin collecting invoices found within the range.
|
// begin collecting invoices found within the range.
|
||||||
resp.Payments = append(resp.Payments, payment)
|
resp.Payments = append(resp.Payments, payment)
|
||||||
|
|
||||||
return true, nil
|
return true, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1294,7 +1307,8 @@ func (p *KVPaymentsDB) QueryPayments(query PaymentsQuery) (PaymentsResponse, err
|
|||||||
|
|
||||||
// In non-boltdb database backends, there's a faster
|
// In non-boltdb database backends, there's a faster
|
||||||
// ForAll query that allows for batch fetching items.
|
// ForAll query that allows for batch fetching items.
|
||||||
if fastBucket, ok := indexes.(kvdb.ExtendedRBucket); ok {
|
fastBucket, ok := indexes.(kvdb.ExtendedRBucket)
|
||||||
|
if ok {
|
||||||
err = fastBucket.ForAll(countFn)
|
err = fastBucket.ForAll(countFn)
|
||||||
} else {
|
} else {
|
||||||
err = indexes.ForEach(countFn)
|
err = indexes.ForEach(countFn)
|
||||||
@@ -1456,7 +1470,9 @@ func (p *KVPaymentsDB) DeletePayment(paymentHash lntypes.Hash,
|
|||||||
|
|
||||||
for _, htlcID := range toDelete {
|
for _, htlcID := range toDelete {
|
||||||
err = htlcsBucket.Delete(
|
err = htlcsBucket.Delete(
|
||||||
htlcBucketKey(htlcAttemptInfoKey, htlcID),
|
htlcBucketKey(
|
||||||
|
htlcAttemptInfoKey, htlcID,
|
||||||
|
),
|
||||||
)
|
)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
@@ -1470,7 +1486,9 @@ func (p *KVPaymentsDB) DeletePayment(paymentHash lntypes.Hash,
|
|||||||
}
|
}
|
||||||
|
|
||||||
err = htlcsBucket.Delete(
|
err = htlcsBucket.Delete(
|
||||||
htlcBucketKey(htlcSettleInfoKey, htlcID),
|
htlcBucketKey(
|
||||||
|
htlcSettleInfoKey, htlcID,
|
||||||
|
),
|
||||||
)
|
)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
@@ -1485,7 +1503,8 @@ func (p *KVPaymentsDB) DeletePayment(paymentHash lntypes.Hash,
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := payments.DeleteNestedBucket(paymentHash[:]); err != nil {
|
err = payments.DeleteNestedBucket(paymentHash[:])
|
||||||
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1505,7 +1524,9 @@ func (p *KVPaymentsDB) DeletePayment(paymentHash lntypes.Hash,
|
|||||||
// failedHtlcsOnly is set, the payment itself won't be deleted, only failed HTLC
|
// failedHtlcsOnly is set, the payment itself won't be deleted, only failed HTLC
|
||||||
// attempts. The method returns the number of deleted payments, which is always
|
// attempts. The method returns the number of deleted payments, which is always
|
||||||
// 0 if failedHtlcsOnly is set.
|
// 0 if failedHtlcsOnly is set.
|
||||||
func (p *KVPaymentsDB) DeletePayments(failedOnly, failedHtlcsOnly bool) (int, error) {
|
func (p *KVPaymentsDB) DeletePayments(failedOnly,
|
||||||
|
failedHtlcsOnly bool) (int, error) {
|
||||||
|
|
||||||
var numPayments int
|
var numPayments int
|
||||||
err := kvdb.Update(p.db, func(tx kvdb.RwTx) error {
|
err := kvdb.Update(p.db, func(tx kvdb.RwTx) error {
|
||||||
payments := tx.ReadWriteBucket(paymentsRootBucket)
|
payments := tx.ReadWriteBucket(paymentsRootBucket)
|
||||||
@@ -1585,6 +1606,7 @@ func (p *KVPaymentsDB) DeletePayments(failedOnly, failedHtlcsOnly bool) (int, er
|
|||||||
|
|
||||||
deleteIndexes = append(deleteIndexes, seqNrs...)
|
deleteIndexes = append(deleteIndexes, seqNrs...)
|
||||||
numPayments++
|
numPayments++
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
})
|
})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@@ -1675,7 +1697,6 @@ func fetchSequenceNumbers(paymentBucket kvdb.RBucket) ([][]byte, error) {
|
|||||||
return sequenceNumbers, nil
|
return sequenceNumbers, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
// nolint: dupl
|
|
||||||
func serializePaymentCreationInfo(w io.Writer, c *PaymentCreationInfo) error {
|
func serializePaymentCreationInfo(w io.Writer, c *PaymentCreationInfo) error {
|
||||||
var scratch [8]byte
|
var scratch [8]byte
|
||||||
|
|
||||||
@@ -1697,7 +1718,7 @@ func serializePaymentCreationInfo(w io.Writer, c *PaymentCreationInfo) error {
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
if _, err := w.Write(c.PaymentRequest[:]); err != nil {
|
if _, err := w.Write(c.PaymentRequest); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1739,7 +1760,7 @@ func deserializePaymentCreationInfo(r io.Reader) (*PaymentCreationInfo,
|
|||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
reqLen := uint32(byteOrder.Uint32(scratch[:4]))
|
reqLen := byteOrder.Uint32(scratch[:4])
|
||||||
payReq := make([]byte, reqLen)
|
payReq := make([]byte, reqLen)
|
||||||
if reqLen > 0 {
|
if reqLen > 0 {
|
||||||
if _, err := io.ReadFull(r, payReq); err != nil {
|
if _, err := io.ReadFull(r, payReq); err != nil {
|
||||||
@@ -1827,7 +1848,7 @@ func deserializeHTLCAttemptInfo(r io.Reader) (*HTLCAttemptInfo, error) {
|
|||||||
switch {
|
switch {
|
||||||
// Older payment attempts wouldn't have the hash set, in which case we
|
// Older payment attempts wouldn't have the hash set, in which case we
|
||||||
// can just return.
|
// can just return.
|
||||||
case err == io.EOF, err == io.ErrUnexpectedEOF:
|
case errors.Is(err, io.EOF), errors.Is(err, io.ErrUnexpectedEOF):
|
||||||
return a, nil
|
return a, nil
|
||||||
|
|
||||||
case err != nil:
|
case err != nil:
|
||||||
|
|||||||
@@ -1405,7 +1405,9 @@ func createTestPayments(t *testing.T, p *KVPaymentsDB, payments []*payment) {
|
|||||||
// indices for the slice asserts that exactly the same payments in the
|
// indices for the slice asserts that exactly the same payments in the
|
||||||
// slice for the provided indices exist when fetching payments from the
|
// slice for the provided indices exist when fetching payments from the
|
||||||
// database.
|
// database.
|
||||||
func assertPayments(t *testing.T, paymentDB *KVPaymentsDB, payments []*payment) {
|
func assertPayments(t *testing.T, paymentDB *KVPaymentsDB,
|
||||||
|
payments []*payment) {
|
||||||
|
|
||||||
t.Helper()
|
t.Helper()
|
||||||
|
|
||||||
dbPayments, err := paymentDB.FetchPayments()
|
dbPayments, err := paymentDB.FetchPayments()
|
||||||
@@ -1544,7 +1546,9 @@ func testSerializeRoute(t *testing.T, route route.Route) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// deletePayment removes a payment with paymentHash from the payments database.
|
// deletePayment removes a payment with paymentHash from the payments database.
|
||||||
func deletePayment(t *testing.T, db *DB, paymentHash lntypes.Hash, seqNr uint64) {
|
func deletePayment(t *testing.T, db *DB, paymentHash lntypes.Hash,
|
||||||
|
seqNr uint64) {
|
||||||
|
|
||||||
t.Helper()
|
t.Helper()
|
||||||
|
|
||||||
err := kvdb.Update(db, func(tx kvdb.RwTx) error {
|
err := kvdb.Update(db, func(tx kvdb.RwTx) error {
|
||||||
@@ -1561,6 +1565,7 @@ func deletePayment(t *testing.T, db *DB, paymentHash lntypes.Hash, seqNr uint64)
|
|||||||
|
|
||||||
// Delete the index that references this payment.
|
// Delete the index that references this payment.
|
||||||
indexes := tx.ReadWriteBucket(paymentsIndexBucket)
|
indexes := tx.ReadWriteBucket(paymentsIndexBucket)
|
||||||
|
|
||||||
return indexes.Delete(key)
|
return indexes.Delete(key)
|
||||||
}, func() {})
|
}, func() {})
|
||||||
|
|
||||||
@@ -1622,10 +1627,12 @@ func TestFetchPaymentWithSequenceNumber(t *testing.T) {
|
|||||||
|
|
||||||
// Add two duplicates to our second payment.
|
// Add two duplicates to our second payment.
|
||||||
appendDuplicatePayment(
|
appendDuplicatePayment(
|
||||||
t, db, hasDuplicates.PaymentIdentifier, duplicateOneSeqNr, preimg,
|
t, db, hasDuplicates.PaymentIdentifier, duplicateOneSeqNr,
|
||||||
|
preimg,
|
||||||
)
|
)
|
||||||
appendDuplicatePayment(
|
appendDuplicatePayment(
|
||||||
t, db, hasDuplicates.PaymentIdentifier, duplicateTwoSeqNr, preimg,
|
t, db, hasDuplicates.PaymentIdentifier, duplicateTwoSeqNr,
|
||||||
|
preimg,
|
||||||
)
|
)
|
||||||
|
|
||||||
tests := []struct {
|
tests := []struct {
|
||||||
@@ -1665,7 +1672,8 @@ func TestFetchPaymentWithSequenceNumber(t *testing.T) {
|
|||||||
expectedErr: ErrDuplicateNotFound,
|
expectedErr: ErrDuplicateNotFound,
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: "lookup duplicate, no duplicates bucket",
|
name: "lookup duplicate, no duplicates " +
|
||||||
|
"bucket",
|
||||||
paymentHash: noDuplicates.PaymentIdentifier,
|
paymentHash: noDuplicates.PaymentIdentifier,
|
||||||
sequenceNumber: duplicateTwoSeqNr,
|
sequenceNumber: duplicateTwoSeqNr,
|
||||||
expectedErr: ErrNoDuplicateBucket,
|
expectedErr: ErrNoDuplicateBucket,
|
||||||
@@ -1680,12 +1688,15 @@ func TestFetchPaymentWithSequenceNumber(t *testing.T) {
|
|||||||
db, func(tx walletdb.ReadWriteTx) error {
|
db, func(tx walletdb.ReadWriteTx) error {
|
||||||
var seqNrBytes [8]byte
|
var seqNrBytes [8]byte
|
||||||
byteOrder.PutUint64(
|
byteOrder.PutUint64(
|
||||||
seqNrBytes[:], test.sequenceNumber,
|
seqNrBytes[:],
|
||||||
|
test.sequenceNumber,
|
||||||
)
|
)
|
||||||
|
|
||||||
|
//nolint:ll
|
||||||
_, err := fetchPaymentWithSequenceNumber(
|
_, err := fetchPaymentWithSequenceNumber(
|
||||||
tx, test.paymentHash, seqNrBytes[:],
|
tx, test.paymentHash, seqNrBytes[:],
|
||||||
)
|
)
|
||||||
|
|
||||||
return err
|
return err
|
||||||
}, func() {},
|
}, func() {},
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -432,9 +432,9 @@ func TestQueryPayments(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if len(allPayments) != 6 {
|
if len(allPayments) != 6 {
|
||||||
t.Fatalf("Number of payments received does not "+
|
t.Fatalf("Number of payments received does "+
|
||||||
"match expected one. Got %v, want %v.",
|
"not match expected one. Got %v, "+
|
||||||
len(allPayments), 6)
|
"want %v.", len(allPayments), 6)
|
||||||
}
|
}
|
||||||
|
|
||||||
querySlice, err := paymentDB.QueryPayments(tt.query)
|
querySlice, err := paymentDB.QueryPayments(tt.query)
|
||||||
@@ -445,7 +445,8 @@ func TestQueryPayments(t *testing.T) {
|
|||||||
tt.lastIndex != querySlice.LastIndexOffset {
|
tt.lastIndex != querySlice.LastIndexOffset {
|
||||||
|
|
||||||
t.Errorf("First or last index does not match "+
|
t.Errorf("First or last index does not match "+
|
||||||
"expected index. Want (%d, %d), got (%d, %d).",
|
"expected index. Want (%d, %d), "+
|
||||||
|
"got (%d, %d).",
|
||||||
tt.firstIndex, tt.lastIndex,
|
tt.firstIndex, tt.lastIndex,
|
||||||
querySlice.FirstIndexOffset,
|
querySlice.FirstIndexOffset,
|
||||||
querySlice.LastIndexOffset)
|
querySlice.LastIndexOffset)
|
||||||
@@ -453,14 +454,16 @@ func TestQueryPayments(t *testing.T) {
|
|||||||
|
|
||||||
if len(querySlice.Payments) != len(tt.expectedSeqNrs) {
|
if len(querySlice.Payments) != len(tt.expectedSeqNrs) {
|
||||||
t.Errorf("expected: %v payments, got: %v",
|
t.Errorf("expected: %v payments, got: %v",
|
||||||
len(tt.expectedSeqNrs), len(querySlice.Payments))
|
len(tt.expectedSeqNrs),
|
||||||
|
len(querySlice.Payments))
|
||||||
}
|
}
|
||||||
|
|
||||||
for i, seqNr := range tt.expectedSeqNrs {
|
for i, seqNr := range tt.expectedSeqNrs {
|
||||||
q := querySlice.Payments[i]
|
q := querySlice.Payments[i]
|
||||||
if seqNr != q.SequenceNum {
|
if seqNr != q.SequenceNum {
|
||||||
t.Errorf("sequence numbers do not match, "+
|
t.Errorf("sequence numbers do not "+
|
||||||
"got %v, want %v", q.SequenceNum, seqNr)
|
"match, got %v, want %v",
|
||||||
|
q.SequenceNum, seqNr)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|||||||
Reference in new issue
Block a user