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.stream()/Block() fail with only_ops=True on blocks without ops #149

Closed
crokkon opened this issue Jan 21, 2019 · 0 comments
Closed

Comments

@crokkon
Copy link
Contributor

crokkon commented Jan 21, 2019

Expected behavior

blockchain.stream(start, stop, only_ops=True) should return all operations, including virtual ops, contained in the block range from start to stop. The same should be possible via Block(blocknum, only_ops=True) for individual blocks. If a block does not contain operations, the calls should return an empty list.

Actual behavior

blockchain.stream(start, stop, only_ops=True) and Block(blocknum, only_ops=True) fail with a BlockDoesNotExistsException if the block contains no operations.

How to reproduce

from beem.blockchain import Blockchain
b = Blockchain()
for op in b.stream(start=1000, stop=1001, only_ops=True):
    print(op)

or

from beem.block import Block
b = Block(1000, only_ops=True)

Output:

Traceback (most recent call last):
  File "bug_get_ops_in_block.py", line 8, in <module>
    b = Block(1000, only_ops=True)
  File "/usr/local/lib/python3.6/site-packages/beem/block.py", line 76, in __init__
    steem_instance=steem_instance
  File "/usr/local/lib/python3.6/site-packages/beem/blockchainobject.py", line 134, in __init__
    self.refresh()
  File "/usr/local/lib/python3.6/site-packages/beem/block.py", line 156, in refresh
    raise BlockDoesNotExistsException("output: %s of identifier %s" % (str(block), str(self.identifier)))
beem.exceptions.BlockDoesNotExistsException: output: {} of identifier 1000

Environment

# beempy --version
beempy, version 0.20.17
# python --version
Python 3.6.6
crokkon added a commit to crokkon/beem that referenced this issue Jan 21, 2019
Avoid BlockDoesNotExistsException on `blockchain.stream()` and `Block()`
with `only_ops=True` on blocks without ops.
Fixes holgern#149.
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

1 participant