@@ -426,7 +426,7 @@ func (p *KVPaymentsDB) InitPayment(paymentHash lntypes.Hash,
426
426
func (p * KVPaymentsDB ) DeleteFailedAttempts (hash lntypes.Hash ) error {
427
427
if ! p .db .keepFailedPaymentAttempts {
428
428
const failedHtlcsOnly = true
429
- err := p .db . DeletePayment (hash , failedHtlcsOnly )
429
+ err := p .DeletePayment (hash , failedHtlcsOnly )
430
430
if err != nil {
431
431
return err
432
432
}
@@ -1045,10 +1045,10 @@ func htlcBucketKey(prefix, id []byte) []byte {
1045
1045
// FetchPayments returns all sent payments found in the DB.
1046
1046
//
1047
1047
// nolint: dupl
1048
- func (d * DB ) FetchPayments () ([]* MPPayment , error ) {
1048
+ func (p * KVPaymentsDB ) FetchPayments () ([]* MPPayment , error ) {
1049
1049
var payments []* MPPayment
1050
1050
1051
- err := kvdb .View (d , func (tx kvdb.RTx ) error {
1051
+ err := kvdb .View (p . db , func (tx kvdb.RTx ) error {
1052
1052
paymentsBucket := tx .ReadBucket (paymentsRootBucket )
1053
1053
if paymentsBucket == nil {
1054
1054
return nil
@@ -1351,10 +1351,12 @@ type PaymentsResponse struct {
1351
1351
// QueryPayments is a query to the payments database which is restricted
1352
1352
// to a subset of payments by the payments query, containing an offset
1353
1353
// index and a maximum number of returned payments.
1354
- func (d * DB ) QueryPayments (query PaymentsQuery ) (PaymentsResponse , error ) {
1354
+ func (p * KVPaymentsDB ) QueryPayments (query PaymentsQuery ) (PaymentsResponse ,
1355
+ error ) {
1356
+
1355
1357
var resp PaymentsResponse
1356
1358
1357
- if err := kvdb .View (d , func (tx kvdb.RTx ) error {
1359
+ if err := kvdb .View (p . db , func (tx kvdb.RTx ) error {
1358
1360
// Get the root payments bucket.
1359
1361
paymentsBucket := tx .ReadBucket (paymentsRootBucket )
1360
1362
if paymentsBucket == nil {
@@ -1568,10 +1570,10 @@ func fetchPaymentWithSequenceNumber(tx kvdb.RTx, paymentHash lntypes.Hash,
1568
1570
// DeletePayment deletes a payment from the DB given its payment hash. If
1569
1571
// failedHtlcsOnly is set, only failed HTLC attempts of the payment will be
1570
1572
// deleted.
1571
- func (d * DB ) DeletePayment (paymentHash lntypes.Hash ,
1573
+ func (p * KVPaymentsDB ) DeletePayment (paymentHash lntypes.Hash ,
1572
1574
failedHtlcsOnly bool ) error {
1573
1575
1574
- return kvdb .Update (d , func (tx kvdb.RwTx ) error {
1576
+ return kvdb .Update (p . db , func (tx kvdb.RwTx ) error {
1575
1577
payments := tx .ReadWriteBucket (paymentsRootBucket )
1576
1578
if payments == nil {
1577
1579
return nil
@@ -1660,9 +1662,11 @@ func (d *DB) DeletePayment(paymentHash lntypes.Hash,
1660
1662
// failedHtlcsOnly is set, the payment itself won't be deleted, only failed HTLC
1661
1663
// attempts. The method returns the number of deleted payments, which is always
1662
1664
// 0 if failedHtlcsOnly is set.
1663
- func (d * DB ) DeletePayments (failedOnly , failedHtlcsOnly bool ) (int , error ) {
1665
+ func (p * KVPaymentsDB ) DeletePayments (failedOnly , failedHtlcsOnly bool ) (int ,
1666
+ error ) {
1667
+
1664
1668
var numPayments int
1665
- err := kvdb .Update (d , func (tx kvdb.RwTx ) error {
1669
+ err := kvdb .Update (p . db , func (tx kvdb.RwTx ) error {
1666
1670
payments := tx .ReadWriteBucket (paymentsRootBucket )
1667
1671
if payments == nil {
1668
1672
return nil
0 commit comments