pub trait PathSelector<CW, W = U256>{
// Required method
fn select_path(
&self,
graph: &ChannelGraph,
source: Address,
destination: Address,
min_hops: usize,
max_hops: usize,
) -> Result<ChannelPath>;
// Provided method
fn select_auto_path(
&self,
graph: &ChannelGraph,
destination: Address,
) -> Result<ChannelPath> { ... }
}
Expand description
Trait for implementing custom path selection algorithm from the channel graph.
Required Methods§
Sourcefn select_path(
&self,
graph: &ChannelGraph,
source: Address,
destination: Address,
min_hops: usize,
max_hops: usize,
) -> Result<ChannelPath>
fn select_path( &self, graph: &ChannelGraph, source: Address, destination: Address, min_hops: usize, max_hops: usize, ) -> Result<ChannelPath>
Select path of maximum max_hops
from source
to destination
in the given channel graph.
NOTE: the resulting path does not contain source
but does contain destination
.
Fails if no such path can be found.
Provided Methods§
Sourcefn select_auto_path(
&self,
graph: &ChannelGraph,
destination: Address,
) -> Result<ChannelPath>
fn select_auto_path( &self, graph: &ChannelGraph, destination: Address, ) -> Result<ChannelPath>
Constructs a new valid packet Path
from self and the given destination.
This method uses INTERMEDIATE_HOPS
as the maximum number of hops.