Reject payments for expired invoices#1057
Conversation
Codecov Report
@@ Coverage Diff @@
## master #1057 +/- ##
=========================================
+ Coverage 81.97% 83.7% +1.72%
=========================================
Files 97 100 +3
Lines 7489 8836 +1347
Branches 299 341 +42
=========================================
+ Hits 6139 7396 +1257
- Misses 1350 1440 +90
|
pm47
left a comment
There was a problem hiding this comment.
That's better, but still not compliant because BOLT 11 sets a default one-hour expiry:
x (6): data_length variable. expiry time in seconds (big-endian). Default is 3600 (1 hour) if not specified.
This is in fact mitigated by (h/t @araspitzu): |
|
@sstone i see the point of not introducing complexity at the db layer but the rationale behind it was that we can have a fast lookup for expired invoices. The case of |
|
It's not really complexity that worries me, it's rather having a "get data" method that returns different results even if the database you're reading from has not changed. Having |
|
Right, but then if we want to remove non-determinism from these db calls I see only two options:
I propose doing option #2 but as a special case for |
|
Ok I propose that for this PR we just fix |
…ndPreimage, Implement `isExpired` on PaymentRequest, Check for expired payment request in payment handler
|
|
||
| def getPaymentRequest(paymentHash: ByteVector32): Option[PaymentRequest] | ||
|
|
||
| // returns non paid payment request |
There was a problem hiding this comment.
I don't think that comment is true, it will return all payment requests included the ones that have been paid
There was a problem hiding this comment.
In SqlitePaymentDb#L158 we filter for received_at IS NULL so this retrieves only non paid payment requests, note that we update the record setting received_at when receiving a payment.
There was a problem hiding this comment.
Ah ok my bad.... I think we're good to go!
Ensure that we don't accept incoming HTLCs for expired invoices, fixes #1055.