Skip to content

Make Rene Pay Again - #7125

Merged
rustyrussell merged 31 commits into
ElementsProject:masterfrom
Lagrang3:renepay-refactor
May 9, 2024
Merged

Make Rene Pay Again#7125
rustyrussell merged 31 commits into
ElementsProject:masterfrom
Lagrang3:renepay-refactor

Conversation

@Lagrang3

@Lagrang3 Lagrang3 commented Mar 4, 2024

Copy link
Copy Markdown
Collaborator

In this PR I would like to make some code refactoring.

Changes:

  • separate struct chan_extra and struct flow into two different modules,
  • remove unnecessary (and duplicate) functions remove_completed_flow, remove_completed_flowset, commit_flow, and commit_flowset,
  • the concept of a payment route is now implemented in a new data structure called struct route, instead of struct pay_flow,
  • review the concept of flow: a flow consists of a path and a single amount to be delivered through that path,
  • adding a new plugin workflow based on the concept of payment modifiers used in the default pay plugin,
  • manage concurrent payment requests, different command requests for the same payment hash will converge in a single thread, this fixes renepay crashed #7035.

@Lagrang3 Lagrang3 changed the title Refactor renepay WIP Refactor renepay Mar 4, 2024
@Lagrang3
Lagrang3 marked this pull request as draft March 4, 2024 06:07
@Sjors

Sjors commented Mar 4, 2024

Copy link
Copy Markdown
Contributor

Suggested release name: Make Rene Pay Again

@Lagrang3

Lagrang3 commented Mar 4, 2024

Copy link
Copy Markdown
Collaborator Author

Suggested release name: Make Rene Pay Again

Good name for the next release.

@Lagrang3 Lagrang3 changed the title WIP Refactor renepay [WIP] Make Rene Pay Again Mar 6, 2024
@Lagrang3 Lagrang3 mentioned this pull request Mar 27, 2024
@Lagrang3

Copy link
Copy Markdown
Collaborator Author

I've made a rebase on top of PR #7159.

@Lagrang3
Lagrang3 marked this pull request as ready for review April 8, 2024 15:30
@Lagrang3 Lagrang3 changed the title [WIP] Make Rene Pay Again Make Rene Pay Again Apr 8, 2024
@Lagrang3
Lagrang3 force-pushed the renepay-refactor branch 6 times, most recently from a2629e7 to f198631 Compare April 9, 2024 07:42
@Lagrang3 Lagrang3 added this to the v24.05 milestone Apr 9, 2024
@Lagrang3
Lagrang3 force-pushed the renepay-refactor branch from d951722 to a3d4d0d Compare May 6, 2024 09:41
Lagrang3 added 8 commits May 6, 2024 11:17
Flow and chan_extra are two different concepts, we keep their
definitions and APIs separate.
Refactor the payment structure to handle multiple pay requests for the
same or different invoices.
The role of the structure pay_flow is not taken by a new structure
called route.
The uncertainty structure is updated based on the result of a route,
previously chan_extra and pay_flow were used instead.
The plugin global structure is now defined in payplugin.h
- move the plugin executable from pay.c to main.c,
- adapt the plugin main program to handle concurrent pay calls,
Add a new implementation of the payment state machine.
This is based in the `pay` plugin concept of payment modifiers,
but here we take it to the next level.
The payment goes through a virtual machine that includes calling
functions and evaluating conditions.
Lagrang3 added 19 commits May 6, 2024 11:17
Using enum renepay_errorcode simplifies the low level API of chan_extra and flow.
We can extract information about the nature of a function call failure
from its return value.
Resolve a selfpayment right from the result of `sendpay` instead of
waiting for the notification.
- Update the uncertainty network with the gossmap+local_gossmods,
- ignore channels that fail to give their capacity.
Expand the disabled set to include channels that are not present in the
chan_extra_map/uncertainty network.
- use switch case over all possible WIRE_* errors,
- remove the virtual machine for routefail, use a simple two step
  solution: 1. update the gossip and 2. handle error cases
Define a new object called disabledmap that carries information about
the disabled channels and nodes.
Routes contain only routing information and the payment they're linked
to can be obtained through the payment_hash. We remove the dependency of
route building routines from the payment itself. In order to make
plain payment information available we define a payment_info structure.
The route-builder checks the liquidity bounds of each route one at a
time. Every route that satisfy the contraints is recorded in the
uncertainty network and produces an HTLC burden on the channels it uses,
so that the following routes cannot count on the same liquidity twice.
Listpeerchannels would update the local channel information setting the
liquidity in the outgoing channel to known_min=known_max=capacity,
when in fact it should be known_min=known_max=spendable.
@Lagrang3
Lagrang3 force-pushed the renepay-refactor branch 3 times, most recently from 334f382 to 7849329 Compare May 7, 2024 06:50
@Lagrang3
Lagrang3 force-pushed the renepay-refactor branch from 7849329 to 43cae6b Compare May 8, 2024 13:36
@rustyrussell
rustyrussell merged commit 7335777 into ElementsProject:master May 9, 2024
@Lagrang3
Lagrang3 deleted the renepay-refactor branch May 9, 2024 06:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

renepay crashed

4 participants