Skip to content

Commit fae9e63

Browse files
authored
Merge pull request #118 from carlaKC/accounting-logging
multi: add detailed errors and more logging
2 parents 9b59e0a + 091033a commit fae9e63

File tree

3 files changed

+15
-5
lines changed

3 files changed

+15
-5
lines changed

accounting/filter.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ package accounting
22

33
import (
44
"errors"
5+
"fmt"
56
"time"
67

78
"github.com/lightninglabs/lndclient"
@@ -218,7 +219,7 @@ func paymentRequestDestination(paymentRequest string,
218219

219220
payReq, err := decode(paymentRequest)
220221
if err != nil {
221-
return nil, err
222+
return nil, fmt.Errorf("decode payment request failed: %w", err)
222223
}
223224

224225
return &payReq.Destination, nil

accounting/off_chain.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,9 @@ func offChainReportWithPrices(cfg *OffChainConfig, getPrice usdPrice) (Report,
6666
}
6767
filteredInvoices := filterInvoices(cfg.StartTime, cfg.EndTime, invoices)
6868

69+
log.Infof("Retrieved: %v invoices, %v filtered", len(invoices),
70+
len(filteredInvoices))
71+
6972
payments, err := cfg.ListPayments()
7073
if err != nil {
7174
return nil, err
@@ -89,13 +92,18 @@ func offChainReportWithPrices(cfg *OffChainConfig, getPrice usdPrice) (Report,
8992
return nil, err
9093
}
9194

95+
log.Infof("Retrieved: %v payments, %v filtered, %v circular",
96+
len(payments), len(filteredPayments), len(paymentsToSelf))
97+
9298
// Get all our forwards, we do not need to filter them because they
9399
// are already supplied over the relevant range for our query.
94100
forwards, err := cfg.ListForwards()
95101
if err != nil {
96102
return nil, err
97103
}
98104

105+
log.Infof("Retrieved: %v forwards", len(forwards))
106+
99107
u := entryUtils{
100108
getFiat: getPrice,
101109
customCategories: cfg.Categories,

lndwrap/lndwrap.go

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ package lndwrap
55

66
import (
77
"context"
8+
"fmt"
89
"time"
910

1011
"github.com/lightninglabs/lndclient"
@@ -40,7 +41,7 @@ func ListInvoices(ctx context.Context, startOffset, maxInvoices uint64,
4041
if err := paginater.QueryPaginated(
4142
ctx, query, startOffset, maxInvoices,
4243
); err != nil {
43-
return nil, err
44+
return nil, fmt.Errorf("ListInvoices failed: %w", err)
4445
}
4546

4647
return invoices, nil
@@ -74,7 +75,7 @@ func ListPayments(ctx context.Context, startOffset, maxPayments uint64,
7475
if err := paginater.QueryPaginated(
7576
ctx, query, startOffset, maxPayments,
7677
); err != nil {
77-
return nil, err
78+
return nil, fmt.Errorf("ListPayments failed: %w", err)
7879
}
7980

8081
return payments, nil
@@ -111,7 +112,7 @@ func ListForwards(ctx context.Context, maxForwards uint64, startTime,
111112
if err := paginater.QueryPaginated(
112113
ctx, query, 0, maxForwards,
113114
); err != nil {
114-
return nil, err
115+
return nil, fmt.Errorf("ListForwards failed: %w", err)
115116
}
116117

117118
return forwards, nil
@@ -125,7 +126,7 @@ func ListChannels(ctx context.Context, lnd lndclient.LightningClient,
125126
return func() ([]lndclient.ChannelInfo, error) {
126127
resp, err := lnd.ListChannels(ctx)
127128
if err != nil {
128-
return nil, err
129+
return nil, fmt.Errorf("ListChannels failed: %w", err)
129130
}
130131

131132
// If we want all channels, we can just return now.

0 commit comments

Comments
 (0)