bitcoin-dev-project/sim-ln

Feature: Generate Activity From Graph Topology

Closed this issue · 2 comments

Rather than require a user to provide a description of activity, provide a mode that will randomly generate activity based on the graph + some heuristics, eg:

  • Number of channels a node has
  • Size of channels

This is primarily aimed to serve the "regtest" case where the person running the simulation has access to all of the nodes, and can just easily spin up the simulation to run random activity.

Another suggestion here was the ability to augo-gen a balanced/circular flow of payments so that the NPCs create a "perfect" set of activities that will happily run in the background.

A basic outline of what a not-completely-dumb solution could look like:

  • Select source/destination node:
    • Weight probability by channel capacity (with the intuition that more channels -> more activity)
    • If we only pick destination from our controlled nodes we should manage a more-or-less circular flow (sending to nodes that we don't send from means that we'll inevitably drain down, though we could send a little to them).
  • Select random amount to send, somewhat based on sender/receiver capacity.

How that could look in code:

  • If no activity is configured, assume that we're running "random" flows.
  • In generate_activity spin up consume_events tasks for each node we have execution on (right now we only do this for ones where we have activity with the node as the source).
  • Run one produce_random_events loop that takes all the consuming nodes sender chans and create random events.

An alternative approach would be to update produce_events to take some abstraction of a timer, and some closure that produced the NodeAction and then run one producer per source node (like we currently have it). Would need to look into this more to decide which is the better way - I think that configured and random events are pretty distinct use cases, which is why I think it's okay to have separate code (just an instinct).