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