hopr_strategy

Module promiscuous

Source
Expand description

§Promiscuous Strategy

This strategy opens or closes automatically channels based the following rules:

  • if node quality is below or equal to a threshold network_quality_threshold and we have a channel opened to it, the strategy will close it
    • if node quality is above network_quality_threshold and no channel is opened yet, it will try to open channel to it (with initial stake new_channel_stake). However, the channel is opened only if the following is both true:
    • the total node balance does not drop below minimum_node_balance
    • the number of channels opened by this strategy does not exceed max_channels

Also, the candidates for opening (quality > network_quality_threshold), are sorted by best quality first. So that means if some nodes cannot have a channel opened to them, because we hit minimum_node_balance or max_channels, the better quality ones were taking precedence.

The sorting algorithm is intentionally unstable, so that the nodes which have the same quality get random order. The constant k can be also set to a value > 1, which will make the strategy to open more channels for smaller networks, but it would keep the same asymptotic properties. Per default k = 1.

The strategy starts acting only after at least min_network_size_samples network size samples were gathered, which means it does not start opening/closing channels earlier than min_network_size_samples number of minutes after the node has started.

For details on default parameters see PromiscuousStrategyConfig.

Structs§

PromiscuousStrategy
This strategy opens outgoing channels to peers, which have quality above a given threshold. At the same time, it closes outgoing channels opened to peers whose quality dropped below this threshold.
PromiscuousStrategyConfig
Configuration of PromiscuousStrategy.