-
Notifications
You must be signed in to change notification settings - Fork 11
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
Fix depleted daily limit from unspent hits #4
base: main
Are you sure you want to change the base?
Conversation
Tried it and it's working as expected. |
I don't see the code that fixes this.
Could you create a separate PR or issue for this? I think it needs some discussion. |
You can see the code that fixes sit here. It is pretty straight forward. |
I can only see the code for the unrelated issue, not what the title claims to fix. |
Basically what this PR does is that it checks if the amount in invoice is lower than the card limit. Currently it tries to do the payment but the payment obviously fails (if higher than the card limit). This would be ok but it also counts the amount as spent which is
It doesn't make sense to try payment that i guaranteed to fail (above card tx limit). That's why there is the
|
Oh, I see what you mean, but it doesn't fix if the payment fails for another reason than tx limit (e.g., like you mentioned, if there's no route). |
This is true but it is not that big of a deal if the payment is reasonable amount. The problem is someone can disable your bolt card/bolt ring for a day just by a simple tap and requesting more sats than allowed. It is not a big deal if there is 10k sats more of 300k daily limit spent... But this should also be resolved, that's right. |
I believeI believe it would be quite safe to "unspent" a hit when an Exception occurs? |
It should be pretty simple to only add the hit if the payment succeeds. Otherwise, I guess it's fine to fix this first, but I still think we shouldn't prevent requests for precisely maxWithdrawable without more discussion about that. |
Yes, I think so |
If an invoice payment failed (for example an over-limit payment is attempted, or just there's no route) this is still recorded as a spent hit and it may deplete the daily limit. This PR fixes it.
Also now payment request of precisely maxWithdrawable amount doesn't pass since this is probably a PoS error or stealing, not a common payment.