Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

blockchain.get_all_accounts() fails for limit > steps on appbase #28

Closed
crokkon opened this issue Jun 15, 2018 · 1 comment
Closed

blockchain.get_all_accounts() fails for limit > steps on appbase #28

crokkon opened this issue Jun 15, 2018 · 1 comment

Comments

@crokkon
Copy link
Contributor

crokkon commented Jun 15, 2018

Expected behavior

blockchain.get_all_accounts(limit=2000, steps=1000) returns 2000 account names while internally doing two batch calls of 1000 accounts each. This should work on both appbase and non-appbase nodes

Actual behavior

blockchain.get_all_accounts(limit=2000, steps=1000) fails on appbase nodes when limit > steps

How to reproduce

>>> from beem import Steem
>>> from beem.blockchain import Blockchain
>>> s = Steem(node='https://api.steemit.com')
>>> s.rpc.get_use_appbase()
True
>>> len(list(b.get_all_accounts(limit=1000, steps=1000)))
1000
>>> len(list(b.get_all_accounts(limit=2000, steps=1000)))
Traceback (most recent call last):
  File "/usr/local/lib/python3.6/site-packages/beemapi/steemnoderpc.py", line 65, in rpcexec
    reply = super(SteemNodeRPC, self).rpcexec(payload)
  File "/usr/local/lib/python3.6/site-packages/beemapi/graphenerpc.py", line 381, in rpcexec
    raise RPCError(ret['error']['message'])
beemapi.exceptions.RPCError: Bad Cast:Invalid cast from object_type to string

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/lib/python3.6/site-packages/beem/blockchain.py", line 562, in get_all_accounts
    ret = self.steem.rpc.list_accounts({'start': lastname, 'limit': steps, 'order': 'by_name'}, api="database")["accounts"]
  File "/usr/local/lib/python3.6/site-packages/beemapi/graphenerpc.py", line 430, in method
    r = self.rpcexec(query)
  File "/usr/local/lib/python3.6/site-packages/beemapi/steemnoderpc.py", line 87, in rpcexec
    doRetry = self._check_error_message(e, self.error_cnt_call)
  File "/usr/local/lib/python3.6/site-packages/beemapi/steemnoderpc.py", line 146, in _check_error_message
    raise exceptions.UnhandledRPCError(msg)
beemapi.exceptions.UnhandledRPCError: Bad Cast:Invalid cast from object_type to string

It works on non-appbase nodes:

>>> s = Steem("wss://steemd.pevo.science")
>>> s.rpc.get_use_appbase()
False
>>> b = Blockchain(steem_instance=s)
>>> len(list(b.get_all_accounts(limit=2000, steps=1000)))
2000

Environment

# beempy --version
beempy, version 0.19.37
# python --version
Python 3.6.5
@holgern
Copy link
Owner

holgern commented Jun 15, 2018

Thanks for the report. Fixed in 8137a6a.

@holgern holgern closed this as completed Jun 15, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants