Struct lightning::routing::network_graph::NetworkGraph[][src]

pub struct NetworkGraph { /* fields omitted */ }

Represents the network as nodes and channels between them

Implementations

impl NetworkGraph[src]

pub fn get_channels<'a>(&'a self) -> &'a BTreeMap<u64, ChannelInfo>[src]

Returns all known valid channels’ short ids along with announced channel info.

(C-not exported) because we have no mapping for BTreeMaps

pub fn get_nodes<'a>(&'a self) -> &'a BTreeMap<PublicKey, NodeInfo>[src]

Returns all known nodes’ public keys along with announced node info.

(C-not exported) because we have no mapping for BTreeMaps

pub fn get_addresses<'a>(
    &'a self,
    pubkey: &PublicKey
) -> Option<&'a Vec<NetAddress>>
[src]

Get network addresses by node id. Returns None if the requested node is completely unknown, or if node announcement for the node was never received.

(C-not exported) as there is no practical way to track lifetimes of returned values.

pub fn new(genesis_hash: BlockHash) -> NetworkGraph[src]

Creates a new, empty, network graph.

pub fn update_node_from_announcement<T: Verification>(
    &mut self,
    msg: &NodeAnnouncement,
    secp_ctx: &Secp256k1<T>
) -> Result<(), LightningError>
[src]

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 NetGraphMsgHandler’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.

pub fn update_node_from_unsigned_announcement(
    &mut self,
    msg: &UnsignedNodeAnnouncement
) -> Result<(), LightningError>
[src]

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.

pub fn update_channel_from_announcement<T: Verification, C: Deref>(
    &mut self,
    msg: &ChannelAnnouncement,
    chain_access: &Option<C>,
    secp_ctx: &Secp256k1<T>
) -> Result<(), LightningError> where
    C::Target: Access
[src]

Store or update channel info from a channel announcement.

You probably don’t want to call this directly, instead relying on a NetGraphMsgHandler’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.

pub fn update_channel_from_unsigned_announcement<C: Deref>(
    &mut self,
    msg: &UnsignedChannelAnnouncement,
    chain_access: &Option<C>
) -> Result<(), LightningError> where
    C::Target: Access
[src]

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.

pub fn close_channel_from_update(
    &mut self,
    short_channel_id: u64,
    is_permanent: bool
)
[src]

Close a channel 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.

pub fn update_channel<T: Verification>(
    &mut self,
    msg: &ChannelUpdate,
    secp_ctx: &Secp256k1<T>
) -> Result<(), LightningError>
[src]

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 NetGraphMsgHandler’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.

pub fn update_channel_unsigned(
    &mut self,
    msg: &UnsignedChannelUpdate
) -> Result<(), LightningError>
[src]

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.

Trait Implementations

impl Clone for NetworkGraph[src]

impl Display for NetworkGraph[src]

impl PartialEq<NetworkGraph> for NetworkGraph[src]

impl Readable for NetworkGraph[src]

impl StructuralPartialEq for NetworkGraph[src]

impl Writeable for NetworkGraph[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T> ToString for T where
    T: Display + ?Sized
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.