-
Notifications
You must be signed in to change notification settings - Fork 23
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
multi: config timeout receiving invoice #122
multi: config timeout receiving invoice #122
Conversation
This commits aims to let users use a parameter in the rpc to modify the timeout when receiving a invoice from offer creator. Also adds a config param for the server to setup a default value if no paramenter used. Finally the default value is decreased from 100 to 30s
b131dc5
to
2d9c520
Compare
rebased 🙏🏼 |
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #122 +/- ##
======================================
Coverage 0.00% 0.00%
======================================
Files 1 1
Lines 96 96
======================================
Misses 96 96 ☔ View full report in Codecov by Sentry. |
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.
Thanks for doing this @mauricepoirrier! 🚀 Just a few small changes:
- Let's move the change from 100 to 30 seconds to a new commit with a commit message that notes that we're changing to 30 seconds because 100 seconds was too high and made testing more difficult.
- Make both commit messages wrap around at 80 characters
} | ||
|
||
impl OfferHandler { | ||
pub fn new() -> Self { | ||
pub fn new_default() -> Self { |
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.
Hmm I think I'd rather remove this new_default
function and in impl Default
(and wherever else new_default is called) we can just call new(None)
instead?
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.
I addressed this in e989fbb
pub fn new(response_invoice_timeout: Option<u32>) -> Self { | ||
let response_invoice_timeout = match response_invoice_timeout { | ||
Some(timeout) => { | ||
if timeout < 1 { |
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.
Ah is this to make sure a user doesn't set a timeout of zero? I think it'd be good to do validation of this first -- so before OfferHandler::new is called in main.rs, check that the timeout isn't less than 1. If it is less than one log an error! an exit so the user can then provide a valid timeout
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.
I addressed this in 6f18e38
I have bandwidth now! I'll do it over the weekend. |
NOTE: When #131 is merged, this should be extended to cover the new |
I pushed a rebased and updated version of this PR in #148. Have not done much in the way of testing yet tho. |
@mrfelton thanks for the heads-up. A lot going on. This week I'll re take these. Let me know what's the next plan on the other PR so I would close this one. |
It seems lndk still doesn't fail immediately on error. Even when it encounters an error, such as a connection failure with a peer, the CLI continues to wait until it times out. The |
@kannapoix that's a great point! I might check how to do that in a separate PR, probably would mean few more changes. |
Closing this since @mrfelton finished it off with #148. Thank you very much for getting this started @mauricepoirrier ❤️ @kannapoix Yes totally agree, fixing this would be extremely helpful. If either of you would be interested in exploring a fix it'd be very welcome. My understanding is that in most parts of the process, LNDK will fail the payment upon error. But there is one common case where it doesn't: if we've passed the invoice request to the LDK onion messenger and it fails saying it can't find a path -- LNDK should just fail, but instead it goes through the whole timeout. Is this the case you're talking about? This might be a tad bit deceptively tricky to fix but I can outline some thoughts in an issue if it'd be helpful. |
I forgot the details, but probably it was the case your are mentioning. |
This pr solves #120
We could separate this PR in 3 parts regarding the timeout when waiting for a invoice from the offer creator:
pay_offer
to setup a custom timeout for the specific payment.How can reproduce?
Leaving lndk on, disconnect a connect a peer in lnd (my case eclair). Usually it takes a while to setup the network, so it will return the error
Examples
With flag response invoice amount
Without flag
Open to any comment 🙏🏼