mirror of
https://github.com/lightningnetwork/lnd.git
synced 2025-08-24 20:53:07 +02:00
paymentsdb: use querypayments method to make test db agnostic
This commit is contained in:
@@ -2,11 +2,13 @@ package paymentsdb
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"context"
|
||||
"crypto/rand"
|
||||
"crypto/sha256"
|
||||
"errors"
|
||||
"fmt"
|
||||
"io"
|
||||
"math"
|
||||
"reflect"
|
||||
"testing"
|
||||
"time"
|
||||
@@ -1372,9 +1374,21 @@ func assertPayments(t *testing.T, paymentDB *KVPaymentsDB,
|
||||
|
||||
t.Helper()
|
||||
|
||||
dbPayments, err := paymentDB.FetchPayments()
|
||||
ctx := context.Background()
|
||||
|
||||
// We use the query method to fetch payments from the database which
|
||||
// allows us to use this method db agnostic. We fetch all payments in
|
||||
// one go.
|
||||
queryResp, err := paymentDB.QueryPayments(ctx, Query{
|
||||
IndexOffset: 0,
|
||||
MaxPayments: math.MaxUint64,
|
||||
Reversed: false,
|
||||
IncludeIncomplete: true,
|
||||
})
|
||||
require.NoError(t, err, "could not fetch payments from db")
|
||||
|
||||
dbPayments := queryResp.Payments
|
||||
|
||||
// Make sure that the number of fetched payments is the same
|
||||
// as expected.
|
||||
require.Len(
|
||||
|
Reference in New Issue
Block a user