Documentation ¶
Index ¶
- func DisableLog()
- func SetLogWriter(w io.Writer, level string) error
- func SignAnnouncement(signer *lnwallet.MessageSigner, msg lnwire.Message) (*btcec.Signature, error)
- func UseLogger(logger btclog.Logger)
- type AuthenticatedGossiper
- func (d *AuthenticatedGossiper) ProcessLocalAnnouncement(msg lnwire.Message, src *btcec.PublicKey) chan error
- func (d *AuthenticatedGossiper) ProcessRemoteAnnouncement(msg lnwire.Message, src *btcec.PublicKey) chan error
- func (d *AuthenticatedGossiper) Start() error
- func (d *AuthenticatedGossiper) Stop()
- func (d *AuthenticatedGossiper) SynchronizeNode(pub *btcec.PublicKey)
- type Config
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DisableLog ¶
func DisableLog()
DisableLog disables all library log output. Logging output is disabled by default until either UseLogger or SetLogWriter are called.
func SetLogWriter ¶
SetLogWriter uses a specified io.Writer to output package logging info. This allows a caller to direct package logging output without needing a dependency on seelog. If the caller is also using btclog, UseLogger should be used instead.
func SignAnnouncement ¶
SignAnnouncement is a helper function which is used to sign any outgoing channel node node announcement messages.
Types ¶
type AuthenticatedGossiper ¶
type AuthenticatedGossiper struct {
// contains filtered or unexported fields
}
AuthenticatedGossiper is a subsystem which is responsible for receiving announcements validate them and apply the changes to router, syncing lightning network with newly connected nodes, broadcasting announcements after validation, negotiating the channel announcement proofs exchange and handling the premature announcements. All outgoing announcements are expected to be properly signed as dictated in BOLT#7, additionally, all incoming message are expected to be well formed and signed. Invalid messages will be rejected by this struct.
func New ¶
func New(cfg Config) (*AuthenticatedGossiper, error)
New creates a new AuthenticatedGossiper instance, initialized with the passed configuration paramters.
func (*AuthenticatedGossiper) ProcessLocalAnnouncement ¶
func (d *AuthenticatedGossiper) ProcessLocalAnnouncement(msg lnwire.Message, src *btcec.PublicKey) chan error
ProcessLocalAnnouncement sends a new remote announcement message along with the peer that sent the routing message. The announcement will be processed then added to a queue for batched trickled announcement to all connected peers. Local channel announcements don't contain the announcement proof and will not be fully validated. Once the channel proofs are received, the entire channel announcement and update messages will be re-constructed and broadcast to the rest of the network.
func (*AuthenticatedGossiper) ProcessRemoteAnnouncement ¶
func (d *AuthenticatedGossiper) ProcessRemoteAnnouncement(msg lnwire.Message, src *btcec.PublicKey) chan error
ProcessRemoteAnnouncement sends a new remote announcement message along with the peer that sent the routing message. The announcement will be processed then added to a queue for batched trickled announcement to all connected peers. Remote channel announcements should contain the announcement proof and be fully validated.
func (*AuthenticatedGossiper) Start ¶
func (d *AuthenticatedGossiper) Start() error
Start spawns network messages handler goroutine and registers on new block notifications in order to properly handle the premature announcements.
func (*AuthenticatedGossiper) Stop ¶
func (d *AuthenticatedGossiper) Stop()
Stop signals any active goroutines for a graceful closure.
func (*AuthenticatedGossiper) SynchronizeNode ¶
func (d *AuthenticatedGossiper) SynchronizeNode(pub *btcec.PublicKey)
SynchronizeNode sends a message to the service indicating it should synchronize lightning topology state with the target node. This method is to be utilized when a node connections for the first time to provide it with the latest topology update state.
type Config ¶
type Config struct { // Router is the subsystem which is responsible for managing the // topology of lightning network. After incoming channel, node, channel // updates announcements are validated they are sent to the router in // order to be included in the LN graph. Router routing.ChannelGraphSource // Notifier is used for receiving notifications of incoming blocks. // With each new incoming block found we process previously premature // announcements. // // TODO(roasbeef): could possibly just replace this with an epoch // channel. Notifier chainntnfs.ChainNotifier // Broadcast broadcasts a particular set of announcements to all peers // that the daemon is connected to. If supplied, the exclude parameter // indicates that the target peer should be excluded from the // broadcast. Broadcast func(exclude *btcec.PublicKey, msg ...lnwire.Message) error // SendToPeer is a function which allows the service to send a set of // messages to a particular peer identified by the target public key. SendToPeer func(target *btcec.PublicKey, msg ...lnwire.Message) error // ProofMatureDelta the number of confirmations which is needed before // exchange the channel announcement proofs. ProofMatureDelta uint32 // TrickleDelay the period of trickle timer which flushing to the // network the pending batch of new announcements we've received since // the last trickle tick. TrickleDelay time.Duration }
Config defines the configuration for the service. ALL elements within the configuration MUST be non-nil for the service to carry out its duties.