hopr_path::selectors

Trait PathSelector

Source
pub trait PathSelector<CW, W = U256>
where CW: EdgeWeighting<W>, W: Default + Add<W, Output = W>,
{ // 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§

Source

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§

Source

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.

Implementors§

Source§

impl<CW> PathSelector<CW> for DfsPathSelector<CW>
where CW: EdgeWeighting<U256>,