I upgraded to Bitcoin v. 0.4.0, and I think the way "listtransactions" works is different now.

Let's assume I have 10 transactions on my account.

Old behavior:

When I call

listtransactions account='', 1, 10

I get an empty list, and then when I call

listtransactions account='', 1, 11

it would wrap around and give me the first transaction

listtransactions account='', 1, 12

would give me the 2nd one, etc.

New behavior:

When I request a non-existent transaction (i.e. the "from" parameter is more than 10), I always get the first transaction.

Does anybody know if this is by design?


Yes, it was by design. The old behaviour was accidental and was causing a crash in some situations.

Here are the full details:

In version 0.3.24, the 'from' parameter was simply passed into std::advance() to skip the required number of transactions. If the value given was bigger than the number of available transactions, it would wrap around, due to how std::advance() works. I'm not clear on whether advance() is defined to work like that, or if it's dependent on the particular implementation in the library your version was linked against.

Anyway, in version 0.4, the advance() function call was made conditional:

if (txByTime.size() > nFrom) std::advance(it, nFrom);

meaning to only skip some transactions if the number of transactions available is greater than the number you're trying to skip.

The change was made by Gavin Andresen on August 12, 2011 in response to a bug report

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.