Beem: blockchain.get_all_accounts() returns duplicate entries

in #utopian-io8 years ago (edited)

Project Information

Expected behavior

blockchain.get_all_accounts(limit=5000) should return the first 5000 Steem accounts

Actual behavior

blockchain.get_all_accounts(limit=5000) returns 5000 account names, however 4 of them are contained twice in the list, leaving 4996 unique account names

How to reproduce

>>> from beem.blockchain import Blockchain
>>> b = Blockchain()
>>> len(list(b.get_all_accounts(limit=5000)))
5000
>>> len(set(b.get_all_accounts(limit=5000)))
4996

The reason is that the accounts are fetched in batches (default: 1000 accounts per RPC call) where the last result of the previous batch is also the first result of the next batch.

Environment

# beempy --version
beempy, version 0.19.37
# python --version
Python 3.6.5

GitHub Account

https://github.com/crokkon
A Github issue has been created:
https://github.com/holgern/beem/issues/27

Sort:  

Thanks again for the bug report. I already fixed the bug and added a unit test in commit 8137a.

>>> from beem import blockchain

should be replaced by

>>> from beem.blockchain import Blockchain

Your contribution has been evaluated according to Utopian policies and guidelines, as well as a predefined set of questions pertaining to the category.

To view those questions and the relevant answers related to your post, click here.


PO @holger80

indeed, thanks! I've corrected the sample above.

Hello @stmdev, thanks for your report to a very important repository to the steem users!

As I can see below, the issue was acknowledged by the project owner and resolved thanks to you. We love to see that!
We also appreciate the fact that you've found the cause of the issue before submitting a contribution, effectively taking a lot of load off off the developers.

We'd love to see you back soon!

Your contribution has been evaluated according to Utopian policies and guidelines, as well as a predefined set of questions pertaining to the category.

To view those questions and the relevant answers related to your post, click here.


Need help? Write a ticket on https://support.utopian.io/.
Chat with us on Discord.
[utopian-moderator]

Hey @stmdev
Thanks for contributing on Utopian.
We’re already looking forward to your next contribution!

Contributing on Utopian
Learn how to contribute on our website or by watching this tutorial on Youtube.

Want to chat? Join us on Discord https://discord.gg/h52nFrV.

Vote for Utopian Witness!