-
Notifications
You must be signed in to change notification settings - Fork 2.2k
[feature]: add a flag --count_total_invoices to listinvoices #9740
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
base: master
Are you sure you want to change the base?
[feature]: add a flag --count_total_invoices to listinvoices #9740
Conversation
Important Review skippedAuto reviews are limited to specific labels. 🏷️ Labels to auto review (1)
Please check the settings in the CodeRabbit UI or the You can disable this status message by setting the Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
Nice work! I'm wondering what happens if we have a database using KV schema? I don't see any clear error messages for when that is tried. I think what you've implemented is a slightly different behavior than |
Thanks for the positive feedback! |
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.
After taking a look, it seems a few adjustments might still be needed. Specifically, you need to read RPC section of the Makefile documentation:
https://github.com/lightningnetwork/lnd/blob/master/docs/MAKEFILE.md#rpc
It would be best if you could compile the code, test the changes locally, run the unit and itest to verify your changes, and ensure nothing is broken. Additionally, It would be great if you could add an itest
for this change.
Also, please take a look at contribution guidelines:
https://github.com/lightningnetwork/lnd/blob/master/docs/development_guidelines.md#ideal-git-commit-structure
@Dhiren-Mhatre, remember to re-request review from reviewers when ready |
Change Description
Add a
--count_total_invoices
flag to thelistinvoices
RPC command, as requested in issue #9717. This allows users to efficiently count invoices without retrieving all invoice data, which is particularly helpful for large databases.This implementation follows the same pattern as the existing
--count_total_payments
flag for thelistpayments
command.Steps to Test
Build LND with the changes:
Start LND in regtest mode:
lnd --lnddir=~/lnd-test --bitcoin.regtest --bitcoin.active --bitcoin.node=neutrino --no-macaroons --no-rest
Create a wallet and unlock it:
Test the new flag:
lncli --lnddir=~/lnd-test --no-macaroons listinvoices --count_total_invoices
Verify that the response includes the
total_num_invoices
field and doesn't include any invoice data.Pull Request Checklist
Testing
Code Style and Documentation
This PR addresses issue #9717.