-
Notifications
You must be signed in to change notification settings - Fork 912
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
Always notify if a sendpay
payment attempt is resolved
#3405
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Noticed the draft
ness a bit late, decided to just publish my comments anyway.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Noticed the
draft
ness a bit late, decided to just publish my comments anyway.
No worries, I was in a rush and didn't check my implementation of the inversion of ownership too well, so I just wanted to avoid this being merged before I can cross-check it once more :-)
Feedback is always welcome ^^
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ACK dc694eb
8b465f8
to
dd925d8
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
some nits
dd925d8
to
27aa8dc
Compare
…ith no waiter We clone the test above, but this time we don't attach waiters (they'd be racy anyway), and we wait for the notification to be called. This fails, but is fixed in the next two commits.
We're about to move it a bit up in the call-graph, so encapsulate it in its own function.
Changelog-Changed: plugin: `notify_sendpay_success` and `notify_sendpay_failure` are now always called, even if there is no command waiting on the result.
`wallet_payment_store` frees the unstored payment after it has stored it, but we still need that instance for our notifications. This is the smallest possible fix, but I plan to refactor this out.
`wallet_payment_store` would free the `wallet_payment` instance which would then cause us to reload it from the DB. Instead of doing the store->free->load dance we now tell `wallet_payment_store` whether it should take ownership and leave it alone if not. Passing the payment around instead of referencing it through payment_hash and partid is a nice side-effect.
27aa8dc
to
e1264f7
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ACK e1264f7
Sendpay notifications would get sent only if we have an active watcher, and multiple times if we have more than one watcher. This kind of defeats the point since we can't just fire and forget sendpay and wait for the notification if that notification is bound to the watchers.
This PR fixes that by pulling the notification out of the watcher loop, concentrating the error message allocation in a single place, and inverting ownership of
wallet_payment_store
. This also reduces a couple of useless allocations, since we don't store, free, then reload thewallet_payment
anymore.Fixes #3403