-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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: listpayments --count_total_payments should honor --creation_date_start and --creation_date_end #8565
Conversation
Important Auto Review SkippedAuto reviews are limited to the following labels: llm-review. Please add one of these labels to enable auto reviews. Please check the settings in the CodeRabbit UI or the To trigger a single review, invoke the WalkthroughThe recent update enhances the Changes
Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media? 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 as PR comments)
Additionally, you can add CodeRabbit Configration File (
|
@coderabbitai review |
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.
Review Status
Actionable comments generated: 1
Configuration used: CodeRabbit UI
Commits
Files that changed from the base of the PR and between b0552da and f7528b91e1431ed108f8b686c70f101cd896a34d.Files selected for processing (2)
- channeldb/payments.go (1 hunks)
- channeldb/payments_test.go (1 hunks)
Additional comments: 1
channeldb/payments_test.go (1)
- 475-485: The new test case "query max transaction with start and end creation time" is well-structured and aligns with the PR objectives to enhance querying mechanisms by adding checks for creation timestamp start and end dates. It correctly tests the scenario where both
CreationDateStart
andCreationDateEnd
are specified along withCountTotal
set to true, ensuring the functionality works as intended without causing regressions.
listpayments --count_total_payments should honor
--creation_date_start and
--creation_date_end`
listpayments --count_total_payments should honor
--creation_date_start and
--creation_date_end`listpayments --count_total_payments
should honor --creation_date_start
and --creation_date_end
listpayments --count_total_payments
should honor --creation_date_start
and --creation_date_end
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.
Thanks for the PR! Could you fix the commit messages as required by our contribution guidelines?
Check for uninit int with 0 instead of !
- should be 0 for everyone except the query with count total set to true
643034a
to
21832d4
Compare
@yyforyongyu I have address your comment. could you please review? |
@ellemouton could you please review the changes? thanks |
@violetguos - it is in my review queue. Please have patience :) |
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.
Thanks for the PR @violetguos 🙏
I dont think this is the behaviour we want though. If count_total
is set at the same time as start and end dates, then we should count the total number of payments between those start and end dates.
Other comments:
- please remove the
[skip-cl]
in the title of the last commit. We definitely want the CI to run here. - If you change a line of code in one commit - then it should be formatted correctly in that commit. Ie, dont add another commit to fix the formatting.
query.CreationDateEnd == 0 { | ||
// It will only take effect if CreationDateStart and | ||
// CreationDateEnd are not specified. | ||
var ( |
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.
I dont think this is the behaviour we want. I think that we still want to count how many payments there were but we just want to count the ones that happened between the given start and end times.
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.
thanks for the feedback @ellemouton
the original bug report by @AndySchroder specifies that
$ lncli listpayments --creation_date_start 1650000000 --count_total_payments --creation_date_end 1650000001|grep total_num_payments
"total_num_payments": "0"
$
it seems like the original issue had a different interpretation on the expected behaviour
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.
I dont agree. In that example he is specifying a difference in start and end time of 1 second (millisecond?). So it is expected that there are no payments during that time
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.
yes, that time difference was specified to assume there were no payments between that short period of time.
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.
I dont think this is the behaviour we want. I think that we still want to count how many payments there were but we just want to count the ones that happened between the given start and end times.
yes, this was the original purpose of the bug
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.
thanks for the feedback @ellemouton
the original bug report by @AndySchroder specifies that
$ lncli listpayments --creation_date_start 1650000000 --count_total_payments --creation_date_end 1650000001|grep total_num_payments "total_num_payments": "0" $
it seems like the original issue had a different interpretation on the expected behaviour
no, please understand the interpretation that @ellemouton is providing. she understands bug report correctly.
a0f85eb
to
2c8d039
Compare
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.
see my reply to your comment & also see the previous review for comments about commit structuring :)
* [Fix a bug](https://github.com/lightningnetwork/lnd/pull/8565) where | ||
`listpayments --count_total_payments` flag disregarded `--creation_date_start` | ||
and `--creation_date_end`. The payments between the dates would be queried | ||
instead of the total payments if the dates were supplied. |
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.
No, this is not correct.
@yyforyongyu: review reminder |
Sorry for the misinterpretation of the original example provided in the bug report. I currently don't have the capacity to implement the fix due to the change of scope. |
Change Description
Fixes #8530
Add extra check for the creation start and end date
Only query all payments if those are not specified.
Added check for
totalCount
in existing test cases where theCountTotal
flag isn't set.Steps to Test
Run unit tests and integration tests
Pull Request Checklist
Testing
Code Style and Documentation
[skip ci]
in the commit message for small changes.📝 Please see our Contribution Guidelines for further guidance.
Summary by CodeRabbit
New Features
Tests