lnd: [bug]: lncli listchaintxns in reversed order

Background

From lncli documentation:

NAME:
lncli listchaintxns - List transactions from the wallet.

DESCRIPTION:

List all transactions an address of the wallet was involved in.

This call will return a list of wallet related transactions that paid
to an address our wallet controls, or spent utxos that we held. The
start_height and end_height flags can be used to specify an inclusive
block range over which to query for transactions. If the end_height is
less than the start_height, transactions will be queried in reverse.

If the end_height is less than the start_height, transactions will be queried in reverse.

Despite the order of start_height and end_height the transactions are returned in the same order.

Your environment

  • version of lnd v0.15.1-beta
  • which operating system (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
  • version of bitcoind Bitcoin Core RPC client version v22.0.0

Steps to reproduce

  • start lnd
  • mine blocks
  • send transaction
  • mine blocks
  • send transaction
  • mine blocks
  • call 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:

lncli listchaintxns --start_height 1130 --end_height 1140 | grep block_height
    "block_height": 1140,
    "block_height": 1134,
lncli listchaintxns --start_height 1140 --end_height 1130 | grep block_height
    "block_height": 1140,
    "block_height": 1134,

About this issue

  • Original URL
  • State: open
  • Created a year ago
  • Comments: 18 (7 by maintainers)

Commits related to this issue

Most upvoted comments

Hello please can i work on this?

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.