Author

Topic: listtransactions <count> <from> returns incorrect results (Read 1086 times)

legendary
Activity: 1008
Merit: 1007
I agree it's possible, but it's highly inefficient - imagine if there were 10k transactions per account, and you were paging through them in an amortised fashion, finding transactions you had not yet seen, processing them and moving on. Every time you need to check for new transactions starting from where you left off, you have to process every transaction all over again?
If you are trying to monitor for new transactions you want the listsince call, which is designed exactly for this purpose.


Yes, thanks - this is what I've moved on to looking at. I just wasn't sure what use case you'd ever have for listtransactions as it stands? Seemed like a bug. Smiley
staff
Activity: 4326
Merit: 8951
I agree it's possible, but it's highly inefficient - imagine if there were 10k transactions per account, and you were paging through them in an amortised fashion, finding transactions you had not yet seen, processing them and moving on. Every time you need to check for new transactions starting from where you left off, you have to process every transaction all over again?
If you are trying to monitor for new transactions you want the listsince call, which is designed exactly for this purpose.
legendary
Activity: 1008
Merit: 1007
In addition, there is no way to page through the data as it stands because there is no total transaction count?
... You do not need a transaction count to page through the data with that way that it actually works, as I pointed out.
Start from zero and increase by N until you have no results.  Tada.

I agree the documentation is confusing/wrong and needs to be fixed. Do you agree that you can page through it with how it actually works?


I agree it's possible, but it's highly inefficient - imagine if there were 10k transactions per account, and you were paging through them in an amortised fashion, finding transactions you had not yet seen, processing them and moving on. Every time you need to check for new transactions starting from where you left off, you have to process every transaction all over again?
staff
Activity: 4326
Merit: 8951
In addition, there is no way to page through the data as it stands because there is no total transaction count?
... You do not need a transaction count to page through the data with that way that it actually works, as I pointed out.
Start from zero and increase by N until you have no results.  Tada.

I agree the documentation is confusing/wrong and needs to be fixed. Do you agree that you can page through it with how it actually works?
legendary
Activity: 1008
Merit: 1007
The documentation describes:

Quote
Returns up to [count] most recent transactions skipping the first [from] transactions for account [account]

But in actual fact:

Quote
Returns up to [count] most recent transactions skipping the newest [from] transactions for account [account]

In addition, there is no way to page through the data as it stands because there is no total transaction count?
staff
Activity: 4326
Merit: 8951
I think this is works as designed as works as you'd want it to work.

Since it returns that last count, you want the from to be end-index. Indexing the count from the start isn't useful unless you know in advance how many transactions there are.   E.g. to get all of then you would do

bitcoind listtransactions "*" 10 0
bitcoind listtransactions "*" 10 10
bitcoind listtransactions "*" 10 20
...
until you get an empty result.

legendary
Activity: 1008
Merit: 1007
Hi guys,

I'm trying to get a list of the n most recent transactions on an account, using listtransactions. However, the results returned are not the n most recent when you specify the field.

Example:

What you get is only the n - most recent transactions:

Code:
i.e. listtransactions  3 2 

5 oldest
*-----returned data------------
4 old
3 new
2 new <--- from 2
*-----returned data------------
1 new
0 newest

When what you should get is:

Code:
i.e. listtransactions  3 2 

5 oldest
4 old
3 new
*-----returned data------------
2 new <--- from 2
1 new
0 newest
*-----returned data------------

Any idea how I can get the desired result without having to pull every single transaction down, and reverse the index?

Cheers, Paul.
Jump to: