create account

blockchain.stream and blockchain.ops are missing virtual operations by stmdev

View this thread on: hive.blogpeakd.comecency.com
· @stmdev · (edited)
$1.97
blockchain.stream and blockchain.ops are missing virtual operations
#### Expected behavior
`blockchain.stream()` and `blockchain.ops()` should stream both regular and virtual Steem operations. Via optional arguments, it should be possible to stream only virtual operations.

#### Actual behavior
`blockchain.stream()` and `blockchain.ops()` only stream regular operations. Virtual ops like `author_reward`, `curation_reward` and others are not contained in the stream.

`blockchain.ops()` lists an optional parameter `only_virtual_ops`. If set, `blockchain.ops()` fails with

```
TypeError: blocks() got an unexpected keyword argument 'only_virtual_ops'
```

#### How to reproduce

```python
from beem import Steem
from beem.blockchain import Blockchain
s = Steem(node='https://rpc.buildteam.io')
b = Blockchain(s)
for op in b.stream():
    if op['type'] == "author_reward":
        print(op)
        break
```

This script never completes, because none of the ops yielded by `stream()` is a (virtual) "author_reward" op.

The same code with `steem-python` completes within seconds:

```python
from steem import Steem
from steem.blockchain import Blockchain
s = Steem(nodes=['https://rpc.buildteam.io'])
b = Blockchain(s)
for op in b.stream():
    if op['type'] == "author_reward":  
        print(op)
        break
```

##### Stacktrace for `virtual_ops_only`
```python
>>> from beem.blockchain import Blockchain
>>> b = Blockchain()
>>> for op in b.ops(virtual_ops_only=True):
...     print(op)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/lib/python3.6/site-packages/beem/blockchain.py", line 323, in ops
    for block in self.blocks(start=start, stop=stop, **kwargs):
TypeError: blocks() got an unexpected keyword argument 'virtual_ops_only'
```

##### Environment
```
# python --version
Python 3.6.4
# beempy --version
beempy, version 0.19.26
# steempy --version
steempy 1.0.0
```
πŸ‘  , , , ,
properties (23)
authorstmdev
permlinkblockchain-stream-and-blockchain-ops-are-missing-virtual-operations
categoryutopian-io
json_metadata"{"community":"utopian","app":"utopian/1.0.0","format":"markdown","repository":{"id":121505504,"name":"beem","full_name":"holgern/beem","html_url":"https://github.com/holgern/beem","fork":false,"owner":{"login":"holgern"}},"pullRequests":[],"platform":"github","type":"bug-hunting","tags":["utopian-io","beem","python","steemdev","bug"],"moderator":null,"config":{"questions":[{"question":"What was the severity level of the bug?","question_id":"bug-1","answers":[{"answer":"Critical","answer_id":"bug-1-a-1","value":45},{"answer":"Major","answer_id":"bug-1-a-2","value":38.5},{"answer":"Minor","answer_id":"bug-1-a-3","value":29},{"answer":"Trivial","answer_id":"bug-1-a-4","value":0}]},{"question":"Were the steps to reproduce the bug easy to understand and follow?","question_id":"bug-2","answers":[{"answer":"Yes, the steps were clearly understandable and easy to follow.","answer_id":"bug-2-a-1","value":7.5},{"answer":"The steps were easy to follow, but were not described with sufficient clarity.","answer_id":"bug-2-a-2","value":5.25},{"answer":"The description of the steps severely lacked in clarity, but it is possible to reproduce.","answer_id":"bug-2-a-3","value":2.25},{"answer":"The steps are badly explained and nearly impossible to follow.","answer_id":"bug-2-a-4","value":0}]},{"question":"Was the bug a technical issue or a user experience (UX) issue?","question_id":"bug-3","answers":[{"answer":"It was largely technical but also had significant impact on the user experience.","answer_id":"bug-3-a-1","value":10},{"answer":"It was purely technical.","answer_id":"bug-3-a-2","value":9},{"answer":"It described a UX issue caused by a technical error.","answer_id":"bug-3-a-3","value":5},{"answer":"It described a UX issue alone.","answer_id":"bug-3-a-4","value":0}]},{"question":"How common and easy to discover was the bug reported?","question_id":"bug-4","answers":[{"answer":"The bug was a very common occurrence and impacted the end user experience significantly.","answer_id":"bug-4-a-1","value":7.5},{"answer":"The bug was relatively common, but avoidable.","answer_id":"bug-4-a-2","value":6},{"answer":"The bug was very rare but impactful.","answer_id":"bug-4-a-3","value":3},{"answer":"The bug was nearly impossible to encounter without actively looking for it.","answer_id":"bug-4-a-4","value":0}]},{"question":"Has the contributor reported the issue to the project owner prior to submitting it to Utopian?","question_id":"bug-5","answers":[{"answer":"Yes, it was reported by this contributor and acknowledged by the project owner. Utopian was never mentioned in the process.","answer_id":"bug-5-a-1","value":5},{"answer":"Yes, it was reported by this contributor but has to yet be acknowledged by the project owner.","answer_id":"bug-5-a-2","value":4},{"answer":"No, it was not reported, but an effort to alert the project owner has been made.","answer_id":"bug-5-a-3","value":1.25},{"answer":"No, it was not reported OR there is evidence the user contacted the project owner on behalf of Utopian without permission.","answer_id":"bug-5-a-4","value":0}]},{"question":"How would you describe the formatting, language and overall presentation of the post?","question_id":"c-1","answers":[{"answer":"The post is of very high quality.","answer_id":"c-1-a-1","value":10},{"answer":"The post is of decent quality, but not spectacular in any way.","answer_id":"c-1-a-2","value":7},{"answer":"The post is poorly written and/or formatted, but readable.","answer_id":"c-1-a-3","value":3},{"answer":"The post is really hard to read and the content is barely understandable.","answer_id":"c-1-a-4","value":0}]},{"question":"How would you rate the overall value of this contribution on the open source community and ecosystem?","question_id":"c-2","answers":[{"answer":"This contribution brings great and impactful value, and can be used for applications outside the specific project.","answer_id":"c-2-a-1","value":20},{"answer":"This contribution adds significant value to the open source community and ecosystem, or is of critical importance to the specific project.","answer_id":"c-2-a-2","value":16},{"answer":"This contribution adds some value to the open source community and ecosystem or is only valuable to the specific project.","answer_id":"c-2-a-3","value":8},{"answer":"This contribution adds no value to the open source community and ecosystem or the specific project.","answer_id":"c-2-a-4","value":0}]}]},"questions":null,"score":null,"total_influence":null,"staff_pick":null,"staff_pick_by":null}"
created2018-05-03 08:58:15
last_update2018-05-03 10:33:30
depth0
children8
last_payout2018-05-10 08:58:15
cashout_time1969-12-31 23:59:59
total_payout_value1.422 HBD
curator_payout_value0.544 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length1,864
author_reputation10,427,398,400,460
root_title"blockchain.stream and blockchain.ops are missing virtual operations"
beneficiaries
0.
accountutopian.pay
weight1,500
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id53,602,913
net_rshares397,144,516,911
author_curate_reward""
vote details (5)
@cha0s0000 · (edited)
$0.20
Thanks for the contribution it has been approved !

----------------------------------------------------------------------
Need help? Write a ticket on https://support.utopian.io/.
Chat with us on [Discord](https://discord.gg/uTyJkNm).
[[utopian-moderator]](https://utopian.io/moderators)
πŸ‘  
properties (23)
authorcha0s0000
permlinkre-stmdev-blockchain-stream-and-blockchain-ops-are-missing-virtual-operations-20180508t034550310z
categoryutopian-io
json_metadata{"tags":["utopian-io"],"links":["https://support.utopian.io/","https://discord.gg/uTyJkNm","https://utopian.io/moderators"],"app":"steemit/0.1"}
created2018-05-08 03:45:51
last_update2018-05-08 04:37:48
depth1
children5
last_payout2018-05-15 03:45:51
cashout_time1969-12-31 23:59:59
total_payout_value0.147 HBD
curator_payout_value0.049 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length288
author_reputation30,983,518,016,225
root_title"blockchain.stream and blockchain.ops are missing virtual operations"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id54,493,751
net_rshares42,223,404,127
author_curate_reward""
vote details (1)
@holger80 ·
The docu says that ops() should return also virtual operations:
```
ops(start=None, stop=None, **kwargs)
Yields all operations (including virtual operations) starting from start.

Parameters:	
start (int) – Starting block
stop (int) – Stop at this block
mode (str) – We here have the choice between β€œhead” (the last block) and β€œirreversible” (the block that is confirmed by 2/3 of all block producers and is thus irreversible)
only_virtual_ops (bool) – Only yield virtual operations
```
but does not. So it is a valid bug report to me.
properties (22)
authorholger80
permlinkre-cha0s0000-re-stmdev-blockchain-stream-and-blockchain-ops-are-missing-virtual-operations-20180508t042536027z
categoryutopian-io
json_metadata{"tags":["utopian-io"],"app":"steemit/0.1"}
created2018-05-08 04:25:42
last_update2018-05-08 04:25:42
depth2
children1
last_payout2018-05-15 04:25:42
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length535
author_reputation358,857,509,568,825
root_title"blockchain.stream and blockchain.ops are missing virtual operations"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id54,498,614
net_rshares0
@cha0s0000 ·
give me some mins to check it !
properties (22)
authorcha0s0000
permlinkre-holger80-re-cha0s0000-re-stmdev-blockchain-stream-and-blockchain-ops-are-missing-virtual-operations-20180508t043259384z
categoryutopian-io
json_metadata{"tags":["utopian-io"],"app":"steemit/0.1"}
created2018-05-08 04:33:00
last_update2018-05-08 04:33:00
depth3
children0
last_payout2018-05-15 04:33:00
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length31
author_reputation30,983,518,016,225
root_title"blockchain.stream and blockchain.ops are missing virtual operations"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id54,499,393
net_rshares0
@stmdev ·
$41.59
hi @cha0s0000, `author_reward` is a [block chain operation type](https://github.com/holgern/beem/blob/6a89402b178d418d6e8aec049f65ef374fde0d54/beembase/operationids.py#L50) that should come out of `blockchain.stream()`. `only_virtual_ops` is an option to `blockchain.stream()`, see [here](https://github.com/holgern/beem/blob/6a89402b178d418d6e8aec049f65ef374fde0d54/beem/blockchain.py#L405).
I've been in contact with the PO who confirmed this is a bug.
πŸ‘  ,
properties (23)
authorstmdev
permlinkre-cha0s0000-re-stmdev-blockchain-stream-and-blockchain-ops-are-missing-virtual-operations-20180508t042557697z
categoryutopian-io
json_metadata{"tags":["utopian-io"],"users":["cha0s0000"],"links":["https://github.com/holgern/beem/blob/6a89402b178d418d6e8aec049f65ef374fde0d54/beembase/operationids.py#L50","https://github.com/holgern/beem/blob/6a89402b178d418d6e8aec049f65ef374fde0d54/beem/blockchain.py#L405"],"app":"steemit/0.1"}
created2018-05-08 04:25:57
last_update2018-05-08 04:25:57
depth2
children2
last_payout2018-05-15 04:25:57
cashout_time1969-12-31 23:59:59
total_payout_value31.200 HBD
curator_payout_value10.394 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length454
author_reputation10,427,398,400,460
root_title"blockchain.stream and blockchain.ops are missing virtual operations"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id54,498,643
net_rshares8,869,845,490,889
author_curate_reward""
vote details (2)
@cha0s0000 ·
give me some mins to check it !Thank you !
properties (22)
authorcha0s0000
permlinkre-stmdev-re-cha0s0000-re-stmdev-blockchain-stream-and-blockchain-ops-are-missing-virtual-operations-20180508t043328968z
categoryutopian-io
json_metadata{"tags":["utopian-io"],"app":"steemit/0.1"}
created2018-05-08 04:33:30
last_update2018-05-08 04:33:30
depth3
children0
last_payout2018-05-15 04:33:30
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length42
author_reputation30,983,518,016,225
root_title"blockchain.stream and blockchain.ops are missing virtual operations"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id54,499,444
net_rshares0
@utopian-io ·
$0.20
Hello @stmdev. Due to a small delay in reviewing and upvoting this contribution, this comment has been upvoted instead.
πŸ‘  
properties (23)
authorutopian-io
permlinkre-stmdev-re-cha0s0000-re-stmdev-blockchain-stream-and-blockchain-ops-are-missing-virtual-operations-20180509t223750470z
categoryutopian-io
json_metadata{"tags":["utopian-io"],"users":["stmdev"],"app":"steemit/0.1"}
created2018-05-09 22:37:51
last_update2018-05-09 22:37:51
depth3
children0
last_payout2018-05-16 22:37:51
cashout_time1969-12-31 23:59:59
total_payout_value0.150 HBD
curator_payout_value0.048 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length119
author_reputation152,955,367,999,756
root_title"blockchain.stream and blockchain.ops are missing virtual operations"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id54,836,471
net_rshares41,378,936,045
author_curate_reward""
vote details (1)
@steemitboard ·
Congratulations @stmdev! You have completed some achievement on Steemit and have been rewarded with new badge(s) :

[![](https://steemitimages.com/70x80/http://steemitboard.com/notifications/voted.png)](http://steemitboard.com/@stmdev) Award for the number of upvotes received

Click on any badge to view your own Board of Honor on SteemitBoard.
For more information about SteemitBoard, click [here](https://steemit.com/@steemitboard)

If you no longer want to receive notifications, reply to this comment with the word `STOP`

> Upvote this notification to help all Steemit users. Learn why [here](https://steemit.com/steemitboard/@steemitboard/http-i-cubeupload-com-7ciqeo-png)!
properties (22)
authorsteemitboard
permlinksteemitboard-notify-stmdev-20180510t050114000z
categoryutopian-io
json_metadata{"image":["https://steemitboard.com/img/notifications.png"]}
created2018-05-10 05:01:12
last_update2018-05-10 05:01:12
depth1
children0
last_payout2018-05-17 05:01:12
cashout_time1969-12-31 23:59:59
total_payout_value0.000 HBD
curator_payout_value0.000 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length680
author_reputation38,975,615,169,260
root_title"blockchain.stream and blockchain.ops are missing virtual operations"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id54,885,242
net_rshares0
@utopian-io ·
$0.20
Hey @stmdev
**Thanks for contributing on Utopian**. 
We're already looking forward to your next contribution! 

**Contributing on Utopian**
Learn how to contribute on <a href="https://join.utopian.io">our website</a> or by watching <a href="https://www.youtube.com/watch?v=8S1AtrzYY1Q">this tutorial</a> on Youtube.

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

<a href="https://v2.steemconnect.com/sign/account-witness-vote?witness=utopian-io&approve=1">Vote for Utopian Witness!</a>
πŸ‘  
properties (23)
authorutopian-io
permlinkre-stmdev-blockchain-stream-and-blockchain-ops-are-missing-virtual-operations-20180509t223822289z
categoryutopian-io
json_metadata{"tags":["utopian-io"],"users":["stmdev"],"links":["https://join.utopian.io","https://www.youtube.com/watch?v=8S1AtrzYY1Q","https://discord.gg/h52nFrV","https://v2.steemconnect.com/sign/account-witness-vote?witness=utopian-io&approve=1"],"app":"steemit/0.1"}
created2018-05-09 22:38:21
last_update2018-05-09 22:38:21
depth1
children0
last_payout2018-05-16 22:38:21
cashout_time1969-12-31 23:59:59
total_payout_value0.147 HBD
curator_payout_value0.048 HBD
pending_payout_value0.000 HBD
promoted0.000 HBD
body_length505
author_reputation152,955,367,999,756
root_title"blockchain.stream and blockchain.ops are missing virtual operations"
beneficiaries[]
max_accepted_payout1,000,000.000 HBD
percent_hbd10,000
post_id54,836,537
net_rshares40,534,467,962
author_curate_reward""
vote details (1)