config

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Apr 12, 2025 License: AGPL-3.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// DefaultOpenWeights contains the default values for the channel opening heuristic weights.
	DefaultOpenWeights = OpenWeights{
		Capacity: 1,
		Features: 1,
		Hybrid:   0.8,
		Centrality: CentralityWeights{
			Degree:      0.4,
			Betweenness: 0.8,
			Eigenvector: 0.5,
			Closeness:   0.8,
		},
		Channels: ChannelsWeights{
			BaseFee:        1,
			FeeRate:        0.7,
			InboundBaseFee: 0.8,
			InboundFeeRate: 0.7,
			MinHTLC:        1,
			MaxHTLC:        0.6,
			BlockHeight:    0.8,
		},
	}

	// DefaultCloseWeights contains the default values for the channel closing heuristic weights.
	DefaultCloseWeights = CloseWeights{
		Capacity:       0.5,
		Active:         1,
		NumForwards:    0.8,
		ForwardsAmount: 1,
		Fees:           1,
		PingTime:       0.4,
		BlockHeight:    0.6,
		FlapCount:      0.2,
	}
)

Functions

func IterWeights added in v0.2.0

func IterWeights[T Weights](weights T, f func(weight float64) error) error

IterWeights iterates through the weights executing f on each of the values.

func SumWeights added in v0.2.0

func SumWeights[T Weights](weights T) float64

SumWeights returns the sum of the values stored in the weights objects.

Types

type Agent

type Agent struct {
	DryRun            bool              `yaml:"dry_run"`
	AllowForceCloses  bool              `yaml:"allow_force_closes"`
	Blocklist         []string          `yaml:"blocklist"`
	Keeplist          []string          `yaml:"keeplist"`
	ChannelManager    ChannelManager    `yaml:"channel_manager"`
	HeuristicWeights  HeuristicsWeights `yaml:"heuristic_weights"`
	Intervals         Intervals         `yaml:"intervals"`
	AllocationPercent uint64            `yaml:"allocation_percent"`
	MinBatchSize      uint64            `yaml:"min_batch_size"`
	MinChannels       uint64            `yaml:"min_channels"`
	MaxChannels       uint64            `yaml:"max_channels"`
	MinChannelSize    uint64            `yaml:"min_channel_size"`
	MaxChannelSize    uint64            `yaml:"max_channel_size"`
	TargetConf        int32             `yaml:"target_conf"`
}

Agent configuration.

type CentralityWeights added in v0.2.0

type CentralityWeights struct {
	Degree      float64 `yaml:"degree"`
	Betweenness float64 `yaml:"betweenness"`
	Eigenvector float64 `yaml:"eigenvector"`
	Closeness   float64 `yaml:"closeness"`
}

CentralityWeights configuration.

type ChannelManager

type ChannelManager struct {
	MaxSatvB    uint64 `yaml:"max_sat_vb"`
	MinConf     int32  `yaml:"min_conf"`
	BaseFeeMsat uint64 `yaml:"base_fee_msat"`
	FeeRatePPM  uint64 `yaml:"fee_rate_ppm"`
}

ChannelManager configuration.

type ChannelsWeights added in v0.2.0

type ChannelsWeights struct {
	BaseFee        float64 `yaml:"base_fee"`
	FeeRate        float64 `yaml:"fee_rate"`
	InboundBaseFee float64 `yaml:"inbound_base_fee"`
	InboundFeeRate float64 `yaml:"inbound_fee_rate"`
	MinHTLC        float64 `yaml:"min_htlc"`
	MaxHTLC        float64 `yaml:"max_htlc"`
	BlockHeight    float64 `yaml:"block_height"`
}

ChannelsWeights configuration.

type CloseWeights

type CloseWeights struct {
	Capacity       float64 `yaml:"capacity"`
	Active         float64 `yaml:"active"`
	NumForwards    float64 `yaml:"num_forwards"`
	ForwardsAmount float64 `yaml:"forwards_amount"`
	Fees           float64 `yaml:"fees"`
	BlockHeight    float64 `yaml:"block_height"`
	PingTime       float64 `yaml:"ping_time"`
	FlapCount      float64 `yaml:"flap_count"`
}

CloseWeights configuration.

type Config

type Config struct {
	Lightning Lightning `yaml:"lightning"`
	Agent     Agent     `yaml:"agent"`
	Logging   Logging   `yaml:"logging"`
}

Config represents the configuration for the application.

func Load

func Load(path string) (*Config, error)

Load returns a configuration object loaded from a file.

func (*Config) Validate

func (c *Config) Validate() error

Validate returns an error if the configuration is not valid.

type HeuristicsWeights

type HeuristicsWeights struct {
	Close CloseWeights `yaml:"close"`
	Open  OpenWeights  `yaml:"open"`
}

HeuristicsWeights configuration.

type Intervals added in v0.2.0

type Intervals struct {
	Channels        time.Duration `yaml:"channels"`
	RoutingPolicies time.Duration `yaml:"routing_policies"`
}

Intervals configuration.

type Lightning

type Lightning struct {
	RPC RPC `yaml:"rpc"`
}

Lightning configuration.

type Logging

type Logging struct {
	Level string `yaml:"level"`
}

Logging configuration.

type OpenWeights

type OpenWeights struct {
	Capacity   float64           `yaml:"capacity"`
	Features   float64           `yaml:"features"`
	Hybrid     float64           `yaml:"hybrid"`
	Centrality CentralityWeights `yaml:"centrality"`
	Channels   ChannelsWeights   `yaml:"channels"`
}

OpenWeights configuration.

type RPC

type RPC struct {
	Address      string        `yaml:"address"`
	TLSCertPath  string        `yaml:"tls_cert_path"`
	MacaroonPath string        `yaml:"macaroon_path"`
	Timeout      time.Duration `yaml:"timeout"`
}

RPC configuration.

type Weights added in v0.2.0

type Weights interface {
	CloseWeights | OpenWeights | CentralityWeights | ChannelsWeights
}

Weights is a set of different heuristic weights.

Jump to

Keyboard shortcuts

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