hsd icon indicating copy to clipboard operation
hsd copied to clipboard

wallet-rpc: switch the order of transactions returned to most recent

Open kilpatty opened this issue 5 years ago • 6 comments

Re: discussion in the Telegram group. Looks like the intended behavior of this RPC call is to return the most recent transactions first, and then the "from/skip" parameter jumps ahead x number of txs.

kilpatty avatar Jul 16 '20 15:07 kilpatty

See https://github.com/bcoin-org/bcoin/pull/605 -- this rpc call is already problematic for two reasons:

  1. It's not paginated, so a wallet with a huge history is going to timeout anyway
  2. Transactions in the txdb aren't necessarily stored by time, this is a big part of what bcoin-org/bcoin#605 is fixing above.

So although I think this PR is useful and makes the API match Bitcoin Core rpc listtransactions it should be noted that its suboptimal.

Also, if we merge this we need to add a message to the CHANGELOG and update the api-docs.

pinheadmz avatar Jul 22 '20 20:07 pinheadmz

Following up here, I think without pagination, even these sight edits are somewhat useless when it comes to a wallet with a large amount of transactions.

I'm currently seeing roughly 1-2 second response times for this RPC call, and so I think the next step would be to mimic bitcoin core and introduce some kind of pagination. I'll need to do some reading to see how they do it, and if it will require a change to how the transactions are indexed in the walletDB, but will report back here when I get the time to investigate.

kilpatty avatar Aug 07 '20 15:08 kilpatty

Be sure to check out bcoin #605, Braydon wrote pagination stuff already, it just never got reviewed or merged.

pinheadmz avatar Aug 07 '20 15:08 pinheadmz

@kilpatty should we close this and work on a deeper fix instead?

pinheadmz avatar Aug 10 '20 19:08 pinheadmz

I might actually pull the edits from bcoin #605 into this PR and rename. This is a relatively high priority for me as I need it for some internal software, so I'll try to get on it tonight and/or tomorrow. If you want me to just pop it into a new one happy to do that as well.

EDIT: Also I noticed there are further improvements to pagination in bitcoin core recently so I will likely snag those in here as well.

kilpatty avatar Aug 10 '20 21:08 kilpatty

Ok cool, up to you on which branch you push to :-)

pinheadmz avatar Aug 10 '20 21:08 pinheadmz