lncli listinvoices lists all settled and non settled invoices. AFAIK this list is not really used for many things. The main selling point of having this list, is lnd being able to reject payment if it is for incorrect amount or is double payment. (I am not sure if lnd does that on incoming message yet tho).
However, this list is never garbage collected.
I want to be able to manually remove entries, that are expired + a month, both settled and unsettled. I.e. I have many unsettled and expired invoices there, that I created by mistake, and I would like to get rid of them, as they just pollute the space, memory and database. I would also like to remove old settled invoices, as I will store my business transactions in a separate database instead for archiving purposes.
As a separate feature request lncli listinvoices --pending_only should be extended to also support --expired_only (and --non_expired_only). Sure, I can filter this on my side, but without ability to remove invoices, processing expired invoices is going to be O(n^2).
I'll take this.
Hey @orbitalturtle not sure if you noticed, but if you look right above your comment you'll see that PR #1435 has referenced this issue. This means that a contributor has created a PR claims to fix this issue. It's a WIP though, so nothing is confirmed. As we'd like to avoid duplicate work amongst contributors, I'd say you can either help to review that WIP PR, or try to pick up another unclaimed issue. Thanks!
Makes sense, thanks @Roasbeef
This issue and the referenced PR seem to focus on actively removing invoices.
Do you think it also makes sense to have lnd remove expired invoices automatically after a specified amount of time (which is configurable via lnd start parameters)?
it would more than make sense to automatically remove expired unsettled invoices.
why keep them?
imagine someone runs a custodial multi user wallet service on 1 lnd. then you end up with thousands of unsettled expired invoices cluttering the DB and making work with rpc json very memory intensive for no reason.
please guys get this into lnd. auto removal of unneeded data. also a command to purge invoices, no matter the status with a certain age would be nice
thanks for your hard work!!
has anything been done with this? Is there even a way to remove unpaid invoices manually??
My list of expired invoices has grown so big so some clients can't list my invoices anymore. The ability to purge this garbage data whould be awesome! Is there a way to remove expired invoices manually until we have a fix?
Fixed by #4493
Most helpful comment
My list of expired invoices has grown so big so some clients can't list my invoices anymore. The ability to purge this garbage data whould be awesome! Is there a way to remove expired invoices manually until we have a fix?