aliasmgr

package
v0.15.5-beta Latest Latest
Warning

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

Go to latest
Published: Dec 7, 2022 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsAlias

func IsAlias(scid lnwire.ShortChannelID) bool

IsAlias returns true if the passed SCID is an alias. The function determines this by looking at the BlockHeight. If the BlockHeight is greater than startingBlockHeight and less than endBlockHeight, then it is an alias assigned by RequestAlias. These bounds only apply to aliases we generate. Our peers are free to use any range they choose.

Types

type Manager

type Manager struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

Manager is a struct that handles aliases for LND. It has an underlying database that can allocate aliases for channels, stores the peer's last alias for use in our hop hints, and contains mappings that both the Switch and Gossiper use.

func NewManager

func NewManager(db kvdb.Backend) (*Manager, error)

NewManager initializes an alias Manager from the passed database backend.

func (*Manager) AddLocalAlias

func (m *Manager) AddLocalAlias(alias, baseScid lnwire.ShortChannelID,
	gossip bool) error

AddLocalAlias adds a database mapping from the passed alias to the passed base SCID. The gossip boolean marks whether or not to create a mapping that the gossiper will use. It is set to false for the upgrade path where the feature-bit is toggled on and there are existing channels.

func (*Manager) DeleteSixConfs

func (m *Manager) DeleteSixConfs(baseScid lnwire.ShortChannelID) error

DeleteSixConfs removes a mapping for the gossiper once six confirmations have been reached and the channel is public. At this point, only the confirmed SCID should be used.

func (*Manager) FindBaseSCID

func (m *Manager) FindBaseSCID(
	alias lnwire.ShortChannelID) (lnwire.ShortChannelID, error)

FindBaseSCID finds the base SCID for a given alias. This is used in the gossiper to find the correct SCID to lookup in the graph database.

func (*Manager) GetAliases

func (m *Manager) GetAliases(
	base lnwire.ShortChannelID) []lnwire.ShortChannelID

GetAliases fetches the set of aliases stored under a given base SCID from write-through caches.

func (*Manager) GetPeerAlias

func (m *Manager) GetPeerAlias(chanID lnwire.ChannelID) (lnwire.ShortChannelID,
	error)

GetPeerAlias retrieves a peer's alias SCID by the channel's ChanID.

func (*Manager) ListAliases

func (m *Manager) ListAliases() map[lnwire.ShortChannelID][]lnwire.ShortChannelID

ListAliases returns a carbon copy of baseToSet. This is used by the rpc layer.

func (*Manager) PutPeerAlias

func (m *Manager) PutPeerAlias(chanID lnwire.ChannelID,
	alias lnwire.ShortChannelID) error

PutPeerAlias stores the peer's alias SCID once we learn of it in the funding_locked message.

func (*Manager) RequestAlias

func (m *Manager) RequestAlias() (lnwire.ShortChannelID, error)

RequestAlias returns a new ALIAS ShortChannelID to the caller by allocating the next un-allocated ShortChannelID. The starting ShortChannelID is 16000000:0:0 and the ending ShortChannelID is 16250000:16777215:65535. This gives roughly 2^58 possible ALIAS ShortChannelIDs which ensures this space won't get exhausted.

Jump to

Keyboard shortcuts

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