What is Nostr?
Rusty Russell
npub179e…lz4s
2024-09-18 09:38:53

Rusty Russell on Nostr: Last three weeks I've been working on improving payments. Critical to this are five ...

Last three weeks I've been working on improving payments. Critical to this are five things:
1. Better payment routing, a-la min-cost-flow.
2. Better low-level payment injection API
3. Simpler, more reliable implementation.
4. Better simulation and realistic testing.
5. Better gossip maintenance.

For the first, I took the heart off renepay to make "askrene" the payment oracle, which provides "getroutes" for other plugins to use. A primitive version shipped in the current release, but it's already getting better as I start to use it.

Today I finished "injectpaymentonion" which takes incoming payments the same way we deal with incoming HTLCs, unifying things that were previously difficult, like self-pay and bolt12 blinded paths that begin at our own node.

Tying these together is a new plug-in called "xpay". This calls getroutes then injectpaymentonion, then iterates as results come back, feeding back information to askrene as we learn more about the network.

To figure out how well this actually performs, I've got a new format for representing topology, with minimal information (no node names, just channel capacities, details and topology). A simple tool compresses this from a node's gossip store (and decompress back for use). The result is small enough that we can include graph snapshots on our repository for testing.

Then I have written a fake "channeld" which simulates payments through this graph (it knows all the secret keys). This needs to be enhanced with simulating capacity of the channels (deterministically, based on a seed value) and realistic network delays, but it already does MPP timeouts and checks fees and cltv delays.

This should allow me to test this system's performance in a way that mirrors what people actually see, and also measure it against what we have now. It may uncover bugs, but even better it will let me know where to optimize (min cost flow can definitely be a CPU hog!).

And endothermicdev (nprofile…zu7w) is working on ideas for more aggressive gossip gathering: if we're missing part of the map we cannot expect to have reliable payments!
Author Public Key
npub179e9tp4yqtqx4myp35283fz64gxuzmr6n3yxnktux5pnd5t03eps0elz4s