Merge pull request #56 from carlaKC/convenience-accounting

accounting: add constructors and disable fiat option
This commit is contained in:
Carla Kirk-Cohen 2020-06-26 10:26:13 +02:00 committed by GitHub
commit 9f85678ac5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
13 changed files with 437 additions and 324 deletions

126
accounting/config.go Normal file
View file

@ -0,0 +1,126 @@
package accounting
import (
"context"
"time"
"github.com/lightninglabs/faraday/lndwrap"
"github.com/lightninglabs/lndclient"
)
// OffChainConfig contains all the functionality required to produce an off
// chain report.
type OffChainConfig struct {
// ListInvoices lists all our invoices.
ListInvoices func() ([]lndclient.Invoice, error)
// ListPayments lists all our payments.
ListPayments func() ([]lndclient.Payment, error)
// ListForwards lists all our forwards over out relevant period.
ListForwards func() ([]lndclient.ForwardingEvent, error)
// OwnPubKey is our node's public key. We use this value to identify
// payments that are made to our own node.
OwnPubKey string
// StartTime is the time from which the report should be created,
// inclusive.
StartTime time.Time
// EndTime is the time until which the report should be created,
// exclusive.
EndTime time.Time
// DisableFiat is set if we want to produce a report without fiat
// conversions. This is useful for testing, and for cases where our fiat
// data api may be down.
DisableFiat bool
}
// OnChainConfig contains all the functionality required to produce an on chain
// report.
type OnChainConfig struct {
// OpenChannels provides a list of all currently open channels.
OpenChannels func() ([]lndclient.ChannelInfo, error)
// ClosedChannels provides a list of all closed channels.
ClosedChannels func() ([]lndclient.ClosedChannel, error)
// OnChainTransactions provides a list of all on chain transactions
// relevant to our wallet over a block range.
OnChainTransactions func() ([]lndclient.Transaction, error)
// ListSweeps returns the transaction ids of the list of sweeps known
// to lnd.
ListSweeps func() ([]string, error)
// StartTime is the time from which the report should be created,
// inclusive.
StartTime time.Time
// EndTime is the time until which the report should be created,
// exclusive.
EndTime time.Time
// DisableFiat is set if we want to produce a report without fiat
// conversions. This is useful for testing, and for cases where our fiat
// data api may be down.
DisableFiat bool
}
// NewOnChainConfig returns an on chain config from the lnd services provided.
func NewOnChainConfig(ctx context.Context, lnd lndclient.LndServices, startTime,
endTime time.Time, disableFiat bool) *OnChainConfig {
return &OnChainConfig{
OpenChannels: lndwrap.ListChannels(
ctx, lnd.Client, false,
),
ClosedChannels: func() ([]lndclient.ClosedChannel, error) {
return lnd.Client.ClosedChannels(ctx)
},
OnChainTransactions: func() ([]lndclient.Transaction, error) {
return lnd.Client.ListTransactions(ctx)
},
ListSweeps: func() ([]string, error) {
return lnd.WalletKit.ListSweeps(ctx)
},
StartTime: startTime,
EndTime: endTime,
DisableFiat: disableFiat,
}
}
// NewOffChainConfig creates a config for creating off chain reports. It takes
// max parameters which allow control over the pagination size for queries to
// lnd.
func NewOffChainConfig(ctx context.Context, lnd lndclient.LndServices,
maxInvoices, maxPayments, maxForwards uint64, ownPubkey string,
startTime, endTime time.Time, disableFiat bool) *OffChainConfig {
return &OffChainConfig{
ListInvoices: func() ([]lndclient.Invoice, error) {
return lndwrap.ListInvoices(
ctx, 0, maxInvoices,
lnd.Client,
)
},
ListPayments: func() ([]lndclient.Payment, error) {
return lndwrap.ListPayments(
ctx, 0, maxPayments,
lnd.Client,
)
},
ListForwards: func() ([]lndclient.ForwardingEvent, error) {
return lndwrap.ListForwards(
ctx, maxForwards, startTime, endTime,
lnd.Client,
)
},
OwnPubKey: ownPubkey,
StartTime: startTime,
EndTime: endTime,
DisableFiat: disableFiat,
}
}

View file

@ -34,8 +34,15 @@ func invertMsat(msat int64) int64 {
// getConversion is a helper function which queries coincap for a relevant set
// of price data and returns a convert function which can be used to get
// individual price points from this data.
func getConversion(ctx context.Context, startTime,
endTime time.Time) (msatToFiat, error) {
func getConversion(ctx context.Context, startTime, endTime time.Time,
disableFiat bool) (msatToFiat, error) {
// If we don't want fiat values, just return a no-op function.
if disableFiat {
return func(_ int64, _ time.Time) (decimal.Decimal, error) {
return decimal.Zero, nil
}, nil
}
err := utils.ValidateTimeRange(startTime, endTime)
if err != nil {

View file

@ -3,7 +3,6 @@ package accounting
import (
"context"
"errors"
"time"
"github.com/lightninglabs/lndclient"
"github.com/lightningnetwork/lnd/lntypes"
@ -30,35 +29,12 @@ var (
"supported, query more recent timestamp to exclude duplicates")
)
// OffChainConfig contains all the functionality required to produce an off
// chain report.
type OffChainConfig struct {
// ListInvoices lists all our invoices.
ListInvoices func() ([]lndclient.Invoice, error)
// ListPayments lists all our payments.
ListPayments func() ([]lndclient.Payment, error)
// ListForwards lists all our forwards over out relevant period.
ListForwards func() ([]lndclient.ForwardingEvent, error)
// OwnPubKey is our node's public key. We use this value to identify
// payments that are made to our own node.
OwnPubKey string
// StartTime is the time from which the report should be created,
// inclusive.
StartTime time.Time
// EndTime is the time until which the report should be created,
// exclusive.
EndTime time.Time
}
// OffChainReport gets a report of off chain activity using live price data.
func OffChainReport(ctx context.Context, cfg *OffChainConfig) (Report, error) {
// Retrieve a function which can be used to query individual prices,
// or a no-op function if we do not want prices.
getPrice, err := getConversion(
ctx, cfg.StartTime, cfg.EndTime,
ctx, cfg.StartTime, cfg.EndTime, cfg.DisableFiat,
)
if err != nil {
return nil, err

View file

@ -2,45 +2,21 @@ package accounting
import (
"context"
"time"
"github.com/lightninglabs/faraday/utils"
"github.com/lightninglabs/lndclient"
)
// OnChainConfig contains all the functionality required to produce an on chain
// report.
type OnChainConfig struct {
// OpenChannels provides a list of all currently open channels.
OpenChannels func() ([]lndclient.ChannelInfo, error)
// ClosedChannels provides a list of all closed channels.
ClosedChannels func() ([]lndclient.ClosedChannel, error)
// OnChainTransactions provides a list of all on chain transactions
// relevant to our wallet over a block range.
OnChainTransactions func() ([]lndclient.Transaction, error)
// ListSweeps returns the transaction ids of the list of sweeps known
// to lnd.
ListSweeps func() ([]string, error)
// StartTime is the time from which the report should be created,
// inclusive.
StartTime time.Time
// EndTime is the time until which the report should be created,
// exclusive.
EndTime time.Time
}
// OnChainReport produces a report of our on chain activity for a period using
// live price data. Note that this report relies on transactions returned by
// GetTransactions in lnd. If a transaction is not included in this response
// (eg, a remote party opening a channel to us), it will not be included.
func OnChainReport(ctx context.Context, cfg *OnChainConfig) (Report, error) {
// Retrieve a function which can be used to query individual prices.
getPrice, err := getConversion(ctx, cfg.StartTime, cfg.EndTime)
// Retrieve a function which can be used to query individual prices,
// or a no-op function if we do not want prices.
getPrice, err := getConversion(
ctx, cfg.StartTime, cfg.EndTime, cfg.DisableFiat,
)
if err != nil {
return nil, err
}

View file

@ -36,6 +36,10 @@ var onChainReportCommand = cli.Command{
"set, the command will output the report. " +
"Note that write permissions are required.",
},
cli.BoolFlag{
Name: "disable_fiat",
Usage: "Create a report without fiat conversions.",
},
},
Action: queryOnChainReport,
}
@ -47,8 +51,9 @@ func queryOnChainReport(ctx *cli.Context) error {
// Set start and end times from user specified values, defaulting
// to zero if they are not set.
req := &frdrpc.NodeReportRequest{
StartTime: uint64(ctx.Int64("start_time")),
EndTime: uint64(ctx.Int64("end_time")),
StartTime: uint64(ctx.Int64("start_time")),
EndTime: uint64(ctx.Int64("end_time")),
DisableFiat: ctx.IsSet("disable_fiat"),
}
// If start time is zero, default to a week ago.

View file

@ -5,6 +5,7 @@ import (
"time"
"github.com/lightninglabs/faraday/insights"
"github.com/lightninglabs/faraday/lndwrap"
"github.com/lightninglabs/faraday/revenue"
)
@ -24,7 +25,9 @@ func channelInsights(ctx context.Context,
}
return insights.GetChannels(&insights.Config{
OpenChannels: cfg.wrapListChannels(ctx, false),
OpenChannels: lndwrap.ListChannels(
ctx, cfg.Lnd.Client, false,
),
CurrentHeight: func() (u uint32, err error) {
info, err := cfg.Lnd.Client.GetInfo(ctx)
if err != nil {

View file

@ -6,7 +6,6 @@ import (
"fmt"
"github.com/lightninglabs/faraday/accounting"
"github.com/lightninglabs/lndclient"
)
// parseNodeReportRequest parses a report request and returns the config
@ -20,42 +19,23 @@ func parseNodeReportRequest(ctx context.Context, cfg *Config,
return nil, nil, err
}
onChain := &accounting.OnChainConfig{
OpenChannels: cfg.wrapListChannels(ctx, false),
ClosedChannels: func() ([]lndclient.ClosedChannel, error) {
return cfg.Lnd.Client.ClosedChannels(ctx)
},
OnChainTransactions: func() ([]lndclient.Transaction, error) {
return cfg.Lnd.Client.ListTransactions(ctx)
},
ListSweeps: func() ([]string, error) {
return cfg.Lnd.WalletKit.ListSweeps(ctx)
},
StartTime: start,
EndTime: end,
}
// We lookup our pubkey once so that our paid to self function does
// not need to do a lookup for every payment it checks.
info, err := cfg.Lnd.Client.GetInfo(ctx)
if err != nil {
return nil, nil, err
}
pubkey := hex.EncodeToString(info.IdentityPubkey[:])
offChain := &accounting.OffChainConfig{
ListInvoices: func() ([]lndclient.Invoice, error) {
return cfg.wrapListInvoices(ctx)
},
ListPayments: func() ([]lndclient.Payment, error) {
return cfg.wrapListPayments(ctx)
},
ListForwards: func() ([]lndclient.ForwardingEvent, error) {
return cfg.wrapListForwards(ctx, start, end)
},
OwnPubKey: hex.EncodeToString(info.IdentityPubkey[:]),
StartTime: start,
EndTime: end,
}
offChain := accounting.NewOffChainConfig(
ctx, cfg.Lnd, uint64(maxInvoiceQueries),
uint64(maxPaymentQueries), uint64(maxForwardQueries),
pubkey, start, end, req.DisableFiat,
)
onChain := accounting.NewOnChainConfig(
ctx, cfg.Lnd, start, end, req.DisableFiat,
)
return onChain, offChain, nil
}

View file

@ -4,6 +4,7 @@ import (
"context"
"time"
"github.com/lightninglabs/faraday/lndwrap"
"github.com/lightninglabs/faraday/revenue"
"github.com/lightninglabs/lndclient"
)
@ -44,7 +45,7 @@ func getRevenueConfig(ctx context.Context, cfg *Config,
}
return &revenue.Config{
ListChannels: cfg.wrapListChannels(ctx, false),
ListChannels: lndwrap.ListChannels(ctx, cfg.Lnd.Client, false),
ClosedChannels: func() ([]lndclient.ClosedChannel, error) {
return cfg.Lnd.Client.ClosedChannels(ctx)
},

View file

@ -1017,7 +1017,11 @@ type NodeReportRequest struct {
// The unix time from which to produce the report, inclusive.
StartTime uint64 `protobuf:"varint,1,opt,name=start_time,json=startTime,proto3" json:"start_time,omitempty"`
// The unix time until which to produce the report, exclusive.
EndTime uint64 `protobuf:"varint,2,opt,name=end_time,json=endTime,proto3" json:"end_time,omitempty"`
EndTime uint64 `protobuf:"varint,2,opt,name=end_time,json=endTime,proto3" json:"end_time,omitempty"`
//
//Set to generate a report without conversion to fiat. If set, fiat values
//will display as 0.
DisableFiat bool `protobuf:"varint,4,opt,name=disable_fiat,json=disableFiat,proto3" json:"disable_fiat,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
@ -1062,6 +1066,13 @@ func (m *NodeReportRequest) GetEndTime() uint64 {
return 0
}
func (m *NodeReportRequest) GetDisableFiat() bool {
if m != nil {
return m.DisableFiat
}
return false
}
type ReportEntry struct {
// The unix timestamp of the event.
Timestamp uint64 `protobuf:"varint,1,opt,name=timestamp,proto3" json:"timestamp,omitempty"`
@ -1251,102 +1262,103 @@ func init() {
func init() { proto.RegisterFile("rpc.proto", fileDescriptor_77a6da22d6a3feb1) }
var fileDescriptor_77a6da22d6a3feb1 = []byte{
// 1516 bytes of a gzipped FileDescriptorProto
0x1f, 0x8b, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0xff, 0xb4, 0x57, 0x4b, 0x6f, 0xdb, 0xca,
0x15, 0x2e, 0x29, 0x59, 0x8f, 0x23, 0x4b, 0xa6, 0xc7, 0x8e, 0xa3, 0x28, 0x4e, 0x62, 0x10, 0x49,
0xa3, 0xbc, 0xac, 0x44, 0xdd, 0x14, 0x05, 0x0a, 0x54, 0x50, 0xe8, 0x44, 0xa9, 0xf5, 0xc0, 0x58,
0x4e, 0x50, 0xa0, 0x05, 0xc1, 0x52, 0x63, 0x9b, 0xad, 0xf8, 0xc8, 0x70, 0x64, 0xd4, 0x28, 0xba,
0xe9, 0xb6, 0x28, 0xba, 0xc8, 0xa6, 0x9b, 0xee, 0xfa, 0x23, 0xba, 0xec, 0x0f, 0xe8, 0xa6, 0xb8,
0xb8, 0xff, 0xe0, 0xfe, 0x81, 0xbb, 0xbb, 0xcb, 0x8b, 0x79, 0x90, 0x22, 0x15, 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f, 0x7f,
0xfe, 0x35, 0x00, 0x00, 0xff, 0xff, 0x34, 0xff, 0x13, 0x01, 0xf0, 0x0e, 0x00, 0x00,
}
// Reference imports to suppress errors if they are not otherwise used.

View file

@ -347,6 +347,12 @@ message NodeReportRequest {
uint64 end_time = 2;
reserved 3;
/*
Set to generate a report without conversion to fiat. If set, fiat values
will display as 0.
*/
bool disable_fiat = 4;
}
enum EntryType {

View file

@ -94,6 +94,14 @@
"required": false,
"type": "string",
"format": "uint64"
},
{
"name": "disable_fiat",
"description": "Set to generate a report without conversion to fiat. If set, fiat values\nwill display as 0.",
"in": "query",
"required": false,
"type": "boolean",
"format": "boolean"
}
],
"tags": [

View file

@ -16,12 +16,10 @@ import (
"net/http"
"sync"
"sync/atomic"
"time"
proxy "github.com/grpc-ecosystem/grpc-gateway/runtime"
"github.com/lightninglabs/faraday/accounting"
"github.com/lightninglabs/faraday/fiat"
"github.com/lightninglabs/faraday/paginater"
"github.com/lightninglabs/faraday/recommend"
"github.com/lightninglabs/faraday/revenue"
"github.com/lightninglabs/lndclient"
@ -106,139 +104,6 @@ type Config struct {
CORSOrigin string
}
// wrapListChannels wraps the listchannels call to lnd, with a publicOnly bool
// that can be used to toggle whether private channels are included.
func (c *Config) wrapListChannels(ctx context.Context,
publicOnly bool) func() ([]lndclient.ChannelInfo, error) {
return func() ([]lndclient.ChannelInfo, error) {
resp, err := c.Lnd.Client.ListChannels(ctx)
if err != nil {
return nil, err
}
// If we want all channels, we can just return now.
if !publicOnly {
return resp, err
}
// If we only want public channels, we skip over all private
// channels and return a list of public only.
var publicChannels []lndclient.ChannelInfo
for _, channel := range resp {
if channel.Private {
continue
}
publicChannels = append(publicChannels, channel)
}
return publicChannels, nil
}
}
// wrapListInvoices makes paginated calls to lnd to get our full set of
// invoices.
func (c *Config) wrapListInvoices(ctx context.Context) ([]lndclient.Invoice, error) {
var invoices []lndclient.Invoice
query := func(offset, maxInvoices uint64) (uint64, uint64, error) {
resp, err := c.Lnd.Client.ListInvoices(
ctx, lndclient.ListInvoicesRequest{
Offset: offset,
MaxInvoices: maxInvoices,
},
)
if err != nil {
return 0, 0, err
}
invoices = append(invoices, resp.Invoices...)
return resp.LastIndexOffset, uint64(len(resp.Invoices)), nil
}
// Make paginated calls to the invoices API, starting at offset 0 and
// querying our max number of invoices each time.
if err := paginater.QueryPaginated(
ctx, query, 0, uint64(maxInvoiceQueries),
); err != nil {
return nil, err
}
return invoices, nil
}
// wrapListPayments makes a set of paginated calls to lnd to get our full set
// of payments.
func (c *Config) wrapListPayments(ctx context.Context) ([]lndclient.Payment,
error) {
var payments []lndclient.Payment
query := func(offset, maxEvents uint64) (uint64, uint64, error) {
resp, err := c.Lnd.Client.ListPayments(
ctx, lndclient.ListPaymentsRequest{
Offset: offset,
MaxPayments: maxEvents,
},
)
if err != nil {
return 0, 0, err
}
payments = append(payments, resp.Payments...)
return resp.LastIndexOffset, uint64(len(resp.Payments)), nil
}
// Make paginated calls to the payments API, starting at offset 0 and
// querying our max number of payments each time.
if err := paginater.QueryPaginated(
ctx, query, 0, uint64(maxPaymentQueries),
); err != nil {
return nil, err
}
return payments, nil
}
// wrapListForwards makes paginated calls to our forwarding events api.
func (c *Config) wrapListForwards(ctx context.Context, startTime,
endTime time.Time) ([]lndclient.ForwardingEvent, error) {
var forwards []lndclient.ForwardingEvent
query := func(offset, maxEvents uint64) (uint64, uint64, error) {
resp, err := c.Lnd.Client.ForwardingHistory(
ctx, lndclient.ForwardingHistoryRequest{
StartTime: startTime,
EndTime: endTime,
Offset: uint32(offset),
MaxEvents: uint32(maxEvents),
},
)
if err != nil {
return 0, 0, err
}
forwards = append(forwards, resp.Events...)
return uint64(resp.LastIndexOffset),
uint64(len(resp.Events)), nil
}
// Make paginated calls to the forwards API, starting at offset 0 and
// querying our max number of payments each time.
if err := paginater.QueryPaginated(
ctx, query, 0, uint64(maxForwardQueries),
); err != nil {
return nil, err
}
return forwards, nil
}
// NewRPCServer returns a server which will listen for rpc requests on the
// rpc listen address provided. Note that the server returned is not running,
// and should be started using Start().

148
lndwrap/lndwrap.go Normal file
View file

@ -0,0 +1,148 @@
// Package lndwrap wraps various calls to lndclient for convenience. It offers
// wrapping for paginated queries that will obtain all entries from a desired
// index onwards.
package lndwrap
import (
"context"
"time"
"github.com/lightninglabs/faraday/paginater"
"github.com/lightninglabs/lndclient"
)
// ListInvoices makes paginated calls to lnd to get our full set of
// invoices.
func ListInvoices(ctx context.Context, startOffset, maxInvoices uint64,
lnd lndclient.LightningClient) ([]lndclient.Invoice, error) {
var invoices []lndclient.Invoice
query := func(offset, maxInvoices uint64) (uint64, uint64, error) {
resp, err := lnd.ListInvoices(
ctx, lndclient.ListInvoicesRequest{
Offset: offset,
MaxInvoices: maxInvoices,
},
)
if err != nil {
return 0, 0, err
}
invoices = append(invoices, resp.Invoices...)
return resp.LastIndexOffset, uint64(len(resp.Invoices)), nil
}
// Make paginated calls to the invoices API, starting at offset 0 and
// querying our max number of invoices each time.
if err := paginater.QueryPaginated(
ctx, query, startOffset, maxInvoices,
); err != nil {
return nil, err
}
return invoices, nil
}
// ListPayments makes a set of paginated calls to lnd to get our full set
// of payments.
func ListPayments(ctx context.Context, startOffset, maxPayments uint64,
lnd lndclient.LightningClient) ([]lndclient.Payment, error) {
var payments []lndclient.Payment
query := func(offset, maxEvents uint64) (uint64, uint64, error) {
resp, err := lnd.ListPayments(
ctx, lndclient.ListPaymentsRequest{
Offset: offset,
MaxPayments: maxEvents,
},
)
if err != nil {
return 0, 0, err
}
payments = append(payments, resp.Payments...)
return resp.LastIndexOffset, uint64(len(resp.Payments)), nil
}
// Make paginated calls to the payments API, starting at offset 0 and
// querying our max number of payments each time.
if err := paginater.QueryPaginated(
ctx, query, startOffset, maxPayments,
); err != nil {
return nil, err
}
return payments, nil
}
// ListForwards makes paginated calls to our forwarding events api.
func ListForwards(ctx context.Context, maxForwards uint64, startTime,
endTime time.Time, lnd lndclient.LightningClient) (
[]lndclient.ForwardingEvent, error) {
var forwards []lndclient.ForwardingEvent
query := func(offset, maxEvents uint64) (uint64, uint64, error) {
resp, err := lnd.ForwardingHistory(
ctx, lndclient.ForwardingHistoryRequest{
StartTime: startTime,
EndTime: endTime,
Offset: uint32(offset),
MaxEvents: uint32(maxEvents),
},
)
if err != nil {
return 0, 0, err
}
forwards = append(forwards, resp.Events...)
return uint64(resp.LastIndexOffset),
uint64(len(resp.Events)), nil
}
// Make paginated calls to the forwards API, starting at offset 0 and
// querying our max number of payments each time.
if err := paginater.QueryPaginated(
ctx, query, 0, maxForwards,
); err != nil {
return nil, err
}
return forwards, nil
}
// ListChannels wraps the listchannels call to lnd, with a publicOnly bool
// that can be used to toggle whether private channels are included.
func ListChannels(ctx context.Context, lnd lndclient.LightningClient,
publicOnly bool) func() ([]lndclient.ChannelInfo, error) {
return func() ([]lndclient.ChannelInfo, error) {
resp, err := lnd.ListChannels(ctx)
if err != nil {
return nil, err
}
// If we want all channels, we can just return now.
if !publicOnly {
return resp, err
}
// If we only want public channels, we skip over all private
// channels and return a list of public only.
var publicChannels []lndclient.ChannelInfo
for _, channel := range resp {
if channel.Private {
continue
}
publicChannels = append(publicChannels, channel)
}
return publicChannels, nil
}
}