bitcoin-dev-project / bitcoin-dev-project/sim-ln

Feature Request: Investigate Use of Existing Impl Pathfinding

Open
#289 3 comments 0 reactions 1 assignee Claimed by @f3r10 View on GitHub
difficult feature
Dominant language
Rust
Stars
80
Forks
40
Avg merge
18h 49m
Merged PRs (30d)
2

Description

**Describe desired feature**

When running with a fully simulated network, it would be amazing of SimLN could use the same pathfinding as LND/CLN/Eclair. LND would be the highest priority, because it's the majority of the network.

### Possible Approaches

#### Extern C

* Create C libraries that implement each pathfinding algorithm
* CLN: easy, compile library in C
* LND: use `c-shared` to build C shared library
* Eclair: not possible, so far as I know
* Use [extern](https://doc.rust-lang.org/std/keyword.extern.html) to call C code for each pathfinding

This would require some (likely painful) investigation to figure out if the `c-shared` approach would work for LND. There are all sorts of caveats about C-compatible types that I haven't looked into.

#### IPC

* Create "stub" servers that call directly to the implementations routing code:
* Listen on socket, accepting parameters expressed in json
* Run pathfinding
* Return result
* SimLN then spins up each of these small servers using [Command](https://doc.rust-lang.org/std/process/struct.Command.html)
* Implement the `Pathfinder` trait in #273 which is responsible for shooting the request into the socket

Notes:
* I don't have strong opinions on how to handle IPC (never done this myself)
* We _could_ also define a common RPC for these mini-servers, but that's a lot of boilerplate
* Main priority is that this should be ✨ seamless ✨ for the end user, SimLN should handle all the ugly stuff.

**Use case for feature**

A common use case for SimLN's random payment generation is to create "background noise" payments in a network, and then take and measure some action within that busy network.

**Would you like to contribute code for this feature?**

I don't have capacity to take this on right now, but would be happy to participate in design discussions and review.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.