Comments (8)
SGTM. I can work off a hacked interface change in the interim.
from rust-lightning.
I'll likely need to fix this as part of addressing #3085 (comment). Question is how should we structure the error type. Currently, we have:
rust-lightning/lightning/src/ln/outbound_payment.rs
Lines 506 to 518 in 6035c83
We could expand this to include a variant for PaymentFailureReason
. But there are other places where we return Ok
when we may want to return an error. For instance, payment id not found, abandoned, or fulfilled already. Though maybe we should refactor this to hold the lock prior to calling find_route_and_send_payment
. This would eliminate those errors and possibly eliminate the need for PendingOutboundPayment::InvoiceReceived
. Thoughts?
from rust-lightning.
Though maybe we should refactor this to hold the lock prior to calling
find_route_and_send_payment
. This would eliminate those errors and possibly eliminate the need forPendingOutboundPayment::InvoiceReceived
. Thoughts?
Hmm... but that would mean we'd need to hold the lock while calling find_route
.
from rust-lightning.
@jkczyz if you want, I could take this off your hands!? I can expand the Bolt12PaymentError
to include a PaymentFailureReason
variant and handle the places Ok
is returned with more descriptive errors. Also, in pay_for_offer
abort the payment if the offer amount > the available channel liquidity. If that's the approach you'd be okay with 👍
from rust-lightning.
@jkczyz if you want, I could take this off your hands!? I can expand the
Bolt12PaymentError
to include aPaymentFailureReason
variant and handle the placesOk
is returned with more descriptive errors. Also, inpay_for_offer
abort the payment if the offer amount > the available channel liquidity. If that's the approach you'd be okay with 👍
Discussing with @TheBlueMatt offline. Doesn't seem like this is the right approach. Instead, we need to refactor the code such that:
send_payment_for_bolt12_invoice
callspay_route_internal
just likesend_payment_internal
instead of callingfind_route_and_send_payment
send_payment_for_bolt12_invoice
,send_payment_internal
, andfind_route_and_send_payment
use a new utility to find the route to avoid repeating that code again as is already happening in the latter two functionssend_payment_for_bolt12_invoice
calls this new route finding helper before callingpay_route_internal
and uses an error enum that has two variants wrappingBolt12PaymentError
andRetryableSendFailure
, respectivelysend_payment_for_bolt12_invoice
transitions the state fromPendingOutboundPayment::InvoiceReceived
toPendingOutboundPayment::Retryable
instead offind_route_and_send_payment
It seems this will better align our BOLT11 and BOLT12 flows.
@slanesuke Feel free to take that on if you can make it a priority. We have some other work that is blocked on it. It should be mostly straightforward, though feel free to ping me on Discord if you have any questions. Otherwise, I may need to jump on it to unblock some other work.
from rust-lightning.
send_payment_for_bolt12_invoice
calls this new route finding helper before callingpay_route_internal
and uses an error enum that has two variants wrappingBolt12PaymentError
andRetryableSendFailure
, respectively
Alternatively, we could probably just add another variant to Bolt12PaymentError
that wraps RetryableSendFailure
.
from rust-lightning.
@jkczyz if you want, I could take this off your hands!? I can expand the
Bolt12PaymentError
to include aPaymentFailureReason
variant and handle the placesOk
is returned with more descriptive errors. Also, inpay_for_offer
abort the payment if the offer amount > the available channel liquidity. If that's the approach you'd be okay with 👍Discussing with @TheBlueMatt offline. Doesn't seem like this is the right approach. Instead, we need to refactor the code such that:
send_payment_for_bolt12_invoice
callspay_route_internal
just likesend_payment_internal
instead of callingfind_route_and_send_payment
send_payment_for_bolt12_invoice
,send_payment_internal
, andfind_route_and_send_payment
use a new utility to find the route to avoid repeating that code again as is already happening in the latter two functionssend_payment_for_bolt12_invoice
calls this new route finding helper before callingpay_route_internal
and uses an error enum that has two variants wrappingBolt12PaymentError
andRetryableSendFailure
, respectivelysend_payment_for_bolt12_invoice
transitions the state fromPendingOutboundPayment::InvoiceReceived
toPendingOutboundPayment::Retryable
instead offind_route_and_send_payment
It seems this will better align our BOLT11 and BOLT12 flows.
@slanesuke Feel free to take that on if you can make it a priority. We have some other work that is blocked on it. It should be mostly straightforward, though feel free to ping me on Discord if you have any questions. Otherwise, I may need to jump on it to unblock some other work.
@jkczyz thanks for the feedback! It sounds doable, I can take a stab at it and aim to open a PR by the end of the day tomorrow at the latest. If timing becomes/is an issue and it's more urgent, feel free to take care of it. Let me know, but either way works for me.
from rust-lightning.
Now moved the second part to #3174
from rust-lightning.
Related Issues (20)
- Improve docs for `Persist::archive_persisted_channel`
- Consider removing `path_id` from `Responder`
- Upgrade `bitcoin` to `0.32` HOT 1
- Expose `advance_path_by_one` HOT 6
- The link to Sensei in the README is broken
- force close is not always broadcasting latest TX HOT 3
- Put musig2 dependency behind a feature? HOT 4
- #3024 exposes dummy tx in `DiscardFunding`
- Dont abandon payments based on the `payment_id` in an unauthenticated `InvoiceError` message (or any other unauthenticated msg) HOT 3
- Dont fail with `PaymentFailureReason::UserAbandoned` when failing in response to an OM
- Support new experiemntal ranges for offer tlvs HOT 1
- #2989 Followups
- Abort sending early in BOLT12 `pay_for_offer` if we have insufficient funds
- Upgrade bech32 dependency HOT 1
- Onion Message `Responder` creates a circular reference
- Blinded Path Selection May Use Tor-Only as Intro Node HOT 2
- Document persistence failure behavior for all events
- `OnionMessenger` needs a `Notifier`
- #2995 Followups
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from rust-lightning.