-
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
[bug]: lncli listchaintxns in reversed order #7316
Comments
It's true. I wonder what is better here:
I assume not many people has applications build on top of this feature because it has not working for a while. |
I guess the most intuitive behavior would be:
|
Hello please can i work on this? |
@Chinwendu20 ofc, let us know if you have any questions during development + remember to link this issue in the PR |
Thanks @positiveblue . I would work on this |
It's ok. I'll work on another issue. |
Hello all, I might be a bit slow with this but rest assured I am working on it. I am using this as a motivation to get comfortable with the codebase as I aim to apply as a summer of bitcoin intern under this project. I am currently reading documentation to help me become more acquainted with this unfamiliar territory. As soon as I am comfortable I would submit a PR or ask for help but at least from a place of clarity then. |
Take your time @Chinwendu20 Feel free to contact me on Telegram if you need help: @lucasdcf |
Thanks @lucasdcf . Hello I think this 'bug' was intended, see this snippet of code from a function being called by the listchaintxns. Lines 88 to 99 in 983d917
I think we just need to modify the docs. |
Good point. If this is the case, modifying the docs seems like a reasonable idea. |
I may be missing something here but even if we are sorting by number of confirmations rather than height |
Why the outputs should be different? A transaction with |
yes, but then there will never be any difference between I think it would be better to sort by We can leave the API consumers to do the last step and sort it however they want (while we always return them sorted by confirmation order) but then we should return an error if |
I would be happy to implement whatever solution is agreed upon. Thanks for the input @positiveblue |
I think that's ok, we should return an error in the second case.
I think this would be unclear: non-confirmed transactions first, and right after that very old transactions.
I guess this is the best solution.
Do you mean sorted by the number of confirmations, as it is done now? + error + docs
|
I still think there is a use case for users to see confirmed transactions first before non-confirmed transactions i.e. start_height > end_height. I do not think we should return error in that case. We can just remove the bit where there is the same output in both cases. I guess that was the intention of this issue, just that when I saw something contrary boldly commented in the codebase, I thought that might be the behavior agreed upon. I am going through the commit history to see if there is a reason it was kept that way |
In this case, we should add an additional flag, this will be much clearer than controlling order by swapping
As were proposed earlier.
But considering implementation details, I think it would be sufficient and more clear to add an error and change the docs.
|
Oh okay I will implement it as discussed |
Background
From lncli documentation:
If the end_height is less than the start_height, transactions will be queried in reverse.
Despite the order of
start_height
andend_height
the transactions are returned in the same order.Your environment
lnd
v0.15.1-beta
uname -a
on *Nix)Linux f466fc441522 6.1.4-zen2-1-zen #1 ZEN SMP PREEMPT_DYNAMIC Sat, 07 Jan 2023 15:27:06 +0000 x86_64 Linux
bitcoind
Bitcoin Core RPC client version v22.0.0
Steps to reproduce
lncli listchaintxns
Expected behaviour
lncli listchaintxns --start_height 1 --end_height 2000
returns transactions in direct order.lncli listchaintxns --start_height 2000 --end_height 1
returns transactions in reversed order.Actual behaviour
Both return transactions in reversed order:
The text was updated successfully, but these errors were encountered: