feature

package
v0.0.0-...-9dd16ae Latest Latest
Warning

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

Go to latest
Published: Jan 3, 2021 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ValidateDeps

func ValidateDeps(fv *lnwire.FeatureVector) error

ValidateDeps asserts that a feature vector sets all features and their transitive dependencies properly. It assumes that the dependencies between optional and required features are identical, e.g. if a feature is required but its dependency is optional, that is sufficient.

func ValidateRequired

func ValidateRequired(fv *lnwire.FeatureVector) error

ValidateRequired returns an error if the feature vector contains a non-zero number of unknown, required feature bits.

Types

type Config

type Config struct {
	// NoTLVOnion unsets any optional or required TLVOnionPaylod bits from
	// all feature sets.
	NoTLVOnion bool

	// NoStaticRemoteKey unsets any optional or required StaticRemoteKey
	// bits from all feature sets.
	NoStaticRemoteKey bool

	// NoAnchors unsets any bits signaling support for anchor outputs.
	NoAnchors bool

	// NoWumbo unsets any bits signalling support for wumbo channels.
	NoWumbo bool
}

Config houses any runtime modifications to the default set descriptors. For our purposes, this typically means disabling certain features to test legacy protocol interoperability or functionality.

type ErrMissingFeatureDep

type ErrMissingFeatureDep struct {
	// contains filtered or unexported fields
}

ErrMissingFeatureDep is an error signaling that a transitive dependency in a feature vector is not set properly.

func NewErrMissingFeatureDep

func NewErrMissingFeatureDep(dep lnwire.FeatureBit) ErrMissingFeatureDep

NewErrMissingFeatureDep creates a new ErrMissingFeatureDep error.

func (ErrMissingFeatureDep) Error

func (e ErrMissingFeatureDep) Error() string

Error returns a human-readable description of the missing dep error.

type ErrUnknownRequired

type ErrUnknownRequired struct {
	// contains filtered or unexported fields
}

ErrUnknownRequired signals that a feature vector requires certain features that our node is unaware of or does not implement.

func NewErrUnknownRequired

func NewErrUnknownRequired(unknown []lnwire.FeatureBit) ErrUnknownRequired

NewErrUnknownRequired initializes an ErrUnknownRequired with the unknown feature bits.

func (ErrUnknownRequired) Error

func (e ErrUnknownRequired) Error() string

Error returns a human-readable description of the error.

type Manager

type Manager struct {
	// contains filtered or unexported fields
}

Manager is responsible for generating feature vectors for different requested feature sets.

func NewManager

func NewManager(cfg Config) (*Manager, error)

NewManager creates a new feature Manager, applying any custom modifications to its feature sets before returning.

func (*Manager) Get

func (m *Manager) Get(set Set) *lnwire.FeatureVector

Get returns a feature vector for the passed set. If no set is known, an empty feature vector is returned.

func (*Manager) GetRaw

func (m *Manager) GetRaw(set Set) *lnwire.RawFeatureVector

GetRaw returns a raw feature vector for the passed set. If no set is known, an empty raw feature vector is returned.

func (*Manager) ListSets

func (m *Manager) ListSets() []Set

ListSets returns a list of the feature sets that our node supports.

type Set

type Set uint8

Set is an enum identifying various feature sets, which separates the single feature namespace into distinct categories depending what context a feature vector is being used.

const (
	// SetInit identifies features that should be sent in an Init message to
	// a remote peer.
	SetInit Set = iota

	// SetLegacyGlobal identifies features that should be set in the legacy
	// GlobalFeatures field of an Init message, which maintains backwards
	// compatibility with nodes that haven't implemented flat features.
	SetLegacyGlobal

	// SetNodeAnn identifies features that should be advertised on node
	// announcements.
	SetNodeAnn

	// SetInvoice identifies features that should be advertised on invoices
	// generated by the daemon.
	SetInvoice
)

func (Set) String

func (s Set) String() string

String returns a human-readable description of a Set.

Jump to

Keyboard shortcuts

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