Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

paymod: Slow but steady progress (part 02) #3760

Merged
merged 20 commits into from Jul 2, 2020
Merged

paymod: Slow but steady progress (part 02) #3760

merged 20 commits into from Jul 2, 2020

Conversation

cdecker
Copy link
Member

@cdecker cdecker commented Jun 5, 2020

This PR merges into the branch of the first part paymod-01 and not
master. This should reduce the number of commits that are to be reviewed,
but I'm still unclear if merging the first part will re-address this PR to
point to master. It's an experiment, so let's see if this works for stacking
multiple PRs 😉

We start by switching over to json_paymod if we are not running in
COMPAT-mode, as mentioned in the first part of this series.
We then do a lot
of the grunt work required to get pay and paystatus return values to
include the information from our new payment flow. It's not perfect and I
decided not to go for 100% result compatibility, opting instead of guarding
the change behind the COMPAT_V090 flag, allowing for users to test before
making the switch.

No earth shattering changes here, just incremental work, but a couple of that might be interesting to look at:

  • local_channel_hints modifier: fill in the channel_hints from
    listpeers so we don't try to use a channel we should know won't work
    anyway.
  • Collecting results: iterate through the attempt tree and collect the
    information reported to the caller of pay and paystatus. It's also used
    to determine whether the payment is still in progress, and triages the
    errors to bubble up the most important.

Edit: I had to disable the COMPAT-flag switchover, since Travis is testing with COMPAT=0, causing a number of tests to fail. We'll re-arm it once we have fixed all failures and fixed up the tests to match.

Changelog-None

plugins/pay.c Outdated Show resolved Hide resolved
plugins/libplugin-pay.h Show resolved Hide resolved
plugins/libplugin-pay.c Show resolved Hide resolved
plugins/libplugin-pay.c Outdated Show resolved Hide resolved
plugins/libplugin-pay.c Outdated Show resolved Hide resolved
plugins/libplugin-pay.c Show resolved Hide resolved
plugins/libplugin-pay.c Outdated Show resolved Hide resolved
plugins/libplugin-pay.c Show resolved Hide resolved
plugins/libplugin-pay.c Show resolved Hide resolved
plugins/pay.c Show resolved Hide resolved
Copy link
Contributor

@rustyrussell rustyrussell left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mainly minor comments, though JSON return one needs addressing.

Ack 00bbed1

plugins/pay.c Outdated Show resolved Hide resolved
plugins/libplugin-pay.h Show resolved Hide resolved
plugins/libplugin-pay.c Outdated Show resolved Hide resolved
@cdecker
Copy link
Member Author

cdecker commented Jun 22, 2020

Rebased on top of paymod-01:

@cdecker cdecker self-assigned this Jun 29, 2020
@rustyrussell
Copy link
Contributor

Ack a7540de

@rustyrussell
Copy link
Contributor

Needs annotations in a couple of places for direct amount access.

cdecker added 19 commits July 1, 2020 12:20
Since we end up consolidating some of the return values for `pay` and
`paystatus` and change the public interface we need to add the compatibility
flag and guard the switchover behind it.
We can have quite detailed information about our local channels, so call
`listpeers` before the `getroute` call on the root payment, to seed that
information in the channel_hints.
We'll need it in the next commit to exclude channels and their directions.
An important life lesson: if there is no path to happiness, then trying harder
will still not get you there.
There is a race between `getroute` learning that our peer accepts TLVs and us
initiating the payment. Waiting for announcements ensures we always use TLVs,
matching our expectation in the test / plugin.
This allows us to drive the payment from outside, and still get the
aggregation that we want.
This was racy since we didn't know whether the peer supports TLV payloads yet
so we defaulted to legacy, which doesn't support secrets.
We frequently query by the bolt11 string, so keeping it around saves us from
having to parse the query or serialize the parsed one.
Without this the flapping behavior tested in `test_pay_retry` would reappear.
We're lucky that we can distinguish the severity of the failure based on the
failcode, so we bubble up the one with the maximum failcode, and let callers
inspect details if they need more information.
It was there only for demonstration purposes, and is no longer useful.
@cdecker cdecker changed the base branch from paymod-01 to master July 1, 2020 10:20
@cdecker
Copy link
Member Author

cdecker commented Jul 1, 2020

Rebased on top of master since #3753 has been merged, will address the missing annotations now.

We could end up with multiple channel hints, which is a bit wasteful. We now
look for existing ones before adding a new one, and if one exists we use the
more restrictive parameters.

Suggested-by: Lisa Neigut <@niftynei>
@cdecker
Copy link
Member Author

cdecker commented Jul 2, 2020

Re-applying Rusty's ACK since the requested changes are minimal

Ack a7540de

ACK cf3dfa7

@cdecker cdecker merged commit 7981f4c into master Jul 2, 2020
@rustyrussell rustyrussell deleted the paymod-02 branch August 15, 2022 00:43
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.

None yet

3 participants