Skip to content

[feature]: add a flag --count_total_invoices to listinvoices #9717

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

Open
ZZiigguurraatt opened this issue Apr 14, 2025 · 3 comments
Open

[feature]: add a flag --count_total_invoices to listinvoices #9717

ZZiigguurraatt opened this issue Apr 14, 2025 · 3 comments
Labels
enhancement Improvements to existing features / behaviour

Comments

@ZZiigguurraatt
Copy link

With the listinvoices RPC, when we have a large database, we don't have a way to determine the total number of invoices for a large database because we can't fetch a copy of all invoices because of #9716 . Also, it's likely that #9709 might apply to listinvoices as well after #9716 is fixed.

listpayments has a --count_total_payments option which is a workaround to #9709 for counting the total number of payments.

Even if the above issues were fixed for listinvoices, the client isn't going to want to receive and process through a huge amount of data to just figure out how many invoices there are. We need an analogous --count_total_invoices option for listinvoices. Also, when adding this feature, don't introduce the same kind of problem we see here #8530 for listpayments.

@ZZiigguurraatt ZZiigguurraatt added the enhancement Improvements to existing features / behaviour label Apr 14, 2025
@bhandras
Copy link
Collaborator

For KVDB, we'd need to either add a key to store the total count or read through all the invoices. Do we want this feature for KV?

@ZZiigguurraatt
Copy link
Author

I don't have an opinion. Seems as though we are phasing out KV, so maybe not?

@Dhiren-Mhatre
Copy link

I've submitted PR #9740
Regarding KVDB support, as discussed in the comments, I focused on SQL implementation since KVDB is being phased out. The current implementation will work with SQL backends, and we can determine if KVDB support is needed based on feedback.I've tested the feature locally and confirmed it correctly reports the invoice count without fetching all invoice data.

Thank you for the detailed issue description which made implementing this feature straightforward.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Improvements to existing features / behaviour
Projects
None yet
Development

No branches or pull requests

3 participants