Skip to content

Feature Request: Better route randomization #928

@ZmnSCPxj

Description

@ZmnSCPxj

Currently, riskfactor is intended to provide variations on the route returned by the routing algorithm. However, as riskfactor is applied to all nodes uniformly during routing algorithm, and so I suspect does not give significant route randomization.

Instead, we can do better route randomization by the below:

  1. Accept a randomization seed (which we hash) and an inefficiency parameter (0.0 -> 1.0).
  2. For each node connection, concatenate the short channel ID and the randomization seed, and hash the concatenation, then seed an RNG. The RNG computes a single double (rand_double) in the range (0.0 -> 1.0).
  3. When computing risk_fee, multiply the current return value by (1.0 - inefficiency + (2.0 * inefficiency * rand_double)).

The effects are:

  1. If inefficiency is 0.0, same behavior as current algorithm.
  2. Higher inefficiency leads to potentially higher fees as we are distorting the weight by larger amount, potentially treating exorbitant hops as cheap hops.
  3. If no routing failure reports and new gossip messages, then the same seed and inefficiency parameters will return the same route.

This is also potentially useful for AMP; if we decide to split a payment to a destination supporting AMP we can generate some acceptable inefficiency, then generate some random seeds and try getting multiple routes.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions