scoin / multichain-node

A simple wrapper for Multichain's JSON RPC api that parses your input.
MIT License
73 stars 54 forks source link

listStreamItems doesn't return more than 10 items #26

Closed gvko closed 6 years ago

gvko commented 6 years ago

I know that the default count of the endpoint is 10, so therefore I want to return more items. I call with the following params:

return multichain.listStreamItemsPromise({ stream: 'test', verbose: false, count: 20 })

and it still gives me just 10. No matter how much I change the count to and I have 50+ items in the stream. The interesting part is that if I change it to < 10, f.e. 7, then it returns only 7. When I run the command in the terminal, directly against the multichain-cli, with count = 99, I get back all the items.

gvko commented 6 years ago

Ok, found the issue: start is set to -10 in commands.js and is never being updated. So, if you pass a value that is < 10 for count, then it's fine cuz start will be bigger anyway. But if count is > 10, then start limits you to only the last 10 records (since -10 will start from the last record and go back 10).

scoin commented 6 years ago

Fixed in 2a3bdc7 and 4519ac5

Thanks!