[][src]Struct lightning::ln::router::Router

pub struct Router { /* fields omitted */ }

Tracks a view of the network, receiving updates from peers and generating Routes to payment destinations.

Methods

impl Router[src]

pub fn new(
    our_pubkey: PublicKey,
    chain_monitor: Arc<dyn ChainWatchInterface>,
    logger: Arc<dyn Logger>
) -> Router
[src]

Creates a new router with the given node_id to be used as the source for get_route()

pub fn trace_state(&self)[src]

Dumps the entire network view of this Router to the logger provided in the constructor at level Trace

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

Get network addresses by node id

pub fn mark_node_bad(&self, _node_id: &PublicKey, _blamed_upstream_node: bool)[src]

Marks a node as having failed a route. This will avoid re-using the node in routes for now, with an exponential decay in node "badness". Note that there is deliberately no mark_channel_bad as a node may simply lie and suggest that an upstream channel from it is what failed the route and not the node itself. Instead, setting the blamed_upstream_node boolean will reduce the penalty, returning the node to usability faster. If the node is behaving correctly, it will disable the failing channel and we will use it again next time.

pub fn get_route(
    &self,
    target: &PublicKey,
    first_hops: Option<&[ChannelDetails]>,
    last_hops: &[RouteHint],
    final_value_msat: u64,
    final_cltv: u32
) -> Result<Route, LightningError>
[src]

Gets a route from us to the given target node.

Extra routing hops between known nodes and the target will be used if they are included in last_hops.

If some channels aren't announced, it may be useful to fill in a first_hops with the results from a local ChannelManager::list_usable_channels() call. If it is filled in, our (this Router's) view of our local channels will be ignored, and only those in first_hops will be used.

Panics if first_hops contains channels without short_channel_ids (ChannelManager::list_usable_channels will never include such channels).

The fees on channels from us to next-hops are ignored (as they are assumed to all be equal), however the enabled/disabled bit on such channels as well as the htlc_minimum_msat is checked as they may change based on the receiving node.

Trait Implementations

impl ReadableArgs<RouterReadArgs> for Router[src]

impl RoutingMessageHandler for Router[src]

impl Writeable for Router[src]

Auto Trait Implementations

impl !RefUnwindSafe for Router

impl Send for Router

impl Sync for Router

impl Unpin for Router

impl !UnwindSafe for Router

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, 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.