[−][src]Struct lightning::ln::router::Router
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]
our_pubkey: PublicKey,
chain_monitor: Arc<dyn ChainWatchInterface>,
logger: Arc<dyn Logger>
) -> Router
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]
&self,
target: &PublicKey,
first_hops: Option<&[ChannelDetails]>,
last_hops: &[RouteHint],
final_value_msat: u64,
final_cltv: u32
) -> Result<Route, LightningError>
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<R: Read> ReadableArgs<R, RouterReadArgs> for Router
[src]
fn read(reader: &mut R, args: RouterReadArgs) -> Result<Router, DecodeError>
[src]
impl RoutingMessageHandler for Router
[src]
fn handle_node_announcement(
&self,
msg: &NodeAnnouncement
) -> Result<bool, LightningError>
[src]
&self,
msg: &NodeAnnouncement
) -> Result<bool, LightningError>
fn handle_channel_announcement(
&self,
msg: &ChannelAnnouncement
) -> Result<bool, LightningError>
[src]
&self,
msg: &ChannelAnnouncement
) -> Result<bool, LightningError>
fn handle_htlc_fail_channel_update(&self, update: &HTLCFailChannelUpdate)
[src]
fn handle_channel_update(
&self,
msg: &ChannelUpdate
) -> Result<bool, LightningError>
[src]
&self,
msg: &ChannelUpdate
) -> Result<bool, LightningError>
fn get_next_channel_announcements(
&self,
starting_point: u64,
batch_amount: u8
) -> Vec<(ChannelAnnouncement, ChannelUpdate, ChannelUpdate)>
[src]
&self,
starting_point: u64,
batch_amount: u8
) -> Vec<(ChannelAnnouncement, ChannelUpdate, ChannelUpdate)>
fn get_next_node_announcements(
&self,
starting_point: Option<&PublicKey>,
batch_amount: u8
) -> Vec<NodeAnnouncement>
[src]
&self,
starting_point: Option<&PublicKey>,
batch_amount: u8
) -> Vec<NodeAnnouncement>
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]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = !
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,