pub struct NetworkGraph<L: Deref>where
    L::Target: Logger,
{ /* private fields */ }
Expand description

Represents the network as nodes and channels between them

Implementations

Creates a new, empty, network graph.

Returns a read-only view of the network graph.

The unix timestamp provided by the most recent rapid gossip sync. It will be set by the rapid sync process after every sync completion.

Update the unix timestamp provided by the most recent rapid gossip sync. This should be done automatically by the rapid sync process after every sync completion.

For an already known node (from channel announcements), update its stored properties from a given node announcement.

You probably don’t want to call this directly, instead relying on a P2PGossipSync’s RoutingMessageHandler implementation to call it indirectly. This may be useful to accept routing messages from a source using a protocol other than the lightning P2P protocol.

For an already known node (from channel announcements), update its stored properties from a given node announcement without verifying the associated signatures. Because we aren’t given the associated signatures here we cannot relay the node announcement to any of our peers.

Store or update channel info from a channel announcement.

You probably don’t want to call this directly, instead relying on a P2PGossipSync’s RoutingMessageHandler implementation to call it indirectly. This may be useful to accept routing messages from a source using a protocol other than the lightning P2P protocol.

If a chain::Access object is provided via chain_access, it will be called to verify the corresponding UTXO exists on chain and is correctly-formatted.

Store or update channel info from a channel announcement without verifying the associated signatures. Because we aren’t given the associated signatures here we cannot relay the channel announcement to any of our peers.

If a chain::Access object is provided via chain_access, it will be called to verify the corresponding UTXO exists on chain and is correctly-formatted.

Update channel from partial announcement data received via rapid gossip sync

timestamp: u64: Timestamp emulating the backdated original announcement receipt (by the rapid gossip sync server)

All other parameters as used in msgs::UnsignedChannelAnnouncement fields.

Marks a channel in the graph as failed if a corresponding HTLC fail was sent. If permanent, removes a channel from the local storage. May cause the removal of nodes too, if this was their last channel. If not permanent, makes channels unavailable for routing.

Marks a node in the graph as failed.

Available on crate feature std only.

Removes information about channels that we haven’t heard any updates about in some time. This can be used regularly to prune the network graph of channels that likely no longer exist.

While there is no formal requirement that nodes regularly re-broadcast their channel updates every two weeks, the non-normative section of BOLT 7 currently suggests that pruning occur for updates which are at least two weeks old, which we implement here.

Note that for users of the lightning-background-processor crate this method may be automatically called regularly for you.

This method is only available with the std feature. See NetworkGraph::remove_stale_channels_with_time for no-std use.

Removes information about channels that we haven’t heard any updates about in some time. This can be used regularly to prune the network graph of channels that likely no longer exist.

While there is no formal requirement that nodes regularly re-broadcast their channel updates every two weeks, the non-normative section of BOLT 7 currently suggests that pruning occur for updates which are at least two weeks old, which we implement here.

This function takes the current unix time as an argument. For users with the std feature enabled, NetworkGraph::remove_stale_channels may be preferable.

For an already known (from announcement) channel, update info about one of the directions of the channel.

You probably don’t want to call this directly, instead relying on a P2PGossipSync’s RoutingMessageHandler implementation to call it indirectly. This may be useful to accept routing messages from a source using a protocol other than the lightning P2P protocol.

If built with no-std, any updates with a timestamp more than two weeks in the past or materially in the future will be rejected.

For an already known (from announcement) channel, update info about one of the directions of the channel without verifying the associated signatures. Because we aren’t given the associated signatures here we cannot relay the channel update to any of our peers.

If built with no-std, any updates with a timestamp more than two weeks in the past or materially in the future will be rejected.

Trait Implementations

Formats the value using the given formatter. Read more

Handles the given Event. Read more

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason. Read more

Reads a Self in from the given Read

Writes self out to the given Writer

Writes self out to a Vec

Gets the length of this object after it has been serialized. This can be overridden to optimize cases where we prepend an object with its length. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Converts the given value to a String. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.