revenue

package
v0.2.13-alpha Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 21, 2024 License: MIT Imports: 4 Imported by: 1

Documentation

Index

Constants

View Source
const Subsystem = "REVN"

Subsystem defines the logging code for this subsystem.

Variables

This section is empty.

Functions

func UseLogger

func UseLogger(logger btclog.Logger)

UseLogger uses a specified Logger to output package logging info. This should be used in preference to SetLogWriter if the caller is also using btclog.

Types

type Config

type Config struct {
	// ListChannels returns all open, public channels.
	ListChannels func() ([]lndclient.ChannelInfo, error)

	// ClosedChannels returns all closed channels.
	ClosedChannels func() ([]lndclient.ClosedChannel, error)

	// ForwardingHistory returns paginated forwarding history results.
	// The period that these results queried over determines the period
	// that the report is generated for.
	ForwardingHistory func() ([]lndclient.ForwardingEvent, error)
}

Config contains all the functions required to calculate revenue.

type Report

type Report struct {
	// ChannelPairs contains a map of the string representation of a channel's
	// outpoint to a map of pair channels with which it has generated revenue.
	ChannelPairs map[string]map[string]Revenue
}

Report provides a pairwise report on channel revenue. It maps a target channel to a map of channels that it has forwarded HTLCs with to a record of the revenue produced by each channel in the map. These revenue records report revenue and volume with direction relative to the target channel.

func GetRevenueReport

func GetRevenueReport(cfg *Config) (*Report, error)

GetRevenueReport produces a revenue report over the period specified.

type Revenue

type Revenue struct {
	// AmountOutgoing is the amount in msat that was sent out over the channel
	// as part of forwards with its peer channel.
	AmountOutgoing lnwire.MilliSatoshi

	// AmountIncoming is the amount in msat that arrived on the channel to be
	// forwarded onwards by the peer channel.
	AmountIncoming lnwire.MilliSatoshi

	// FeesOutgoing is the amount in msat of fees that we attribute to the
	// channel for its role as the outgoing channel in forwards.
	FeesOutgoing lnwire.MilliSatoshi

	// FeesIncoming is the amount in msat of fees that we attribute to the
	// channel for its role as the incoming channel in forwards.
	FeesIncoming lnwire.MilliSatoshi
}

Revenue describes the volume of forwards that a channel has been a part of and fees that a channel has generated as a result forward events. Volume and fee are reported by direction, where incoming means that the forward arrived at our node via the channel, and outgoing meaning that the forward left our node via the channel.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL