#### Project Information * Repository: https://github.com/holgern/beem * Project Name: Beem * Publisher: @holger80 #### Expected behavior `account.history()` and `account.get_account_history()` should return only the first blockchain operation of an account when called with `start=0, stop=0, use_block_num=False`. #### Actual behavior `account.history()` returns the full history and `account.get_account_history()` returns `limit+1` operations when called with `start=0, stop=0, use_block_num=False`. #### How to reproduce ```python from beem.account import Account import sys opnum = int(sys.argv[1]) a = Account("stmdev") ops = list(a.history(opnum, opnum, use_block_num=False)) print("a.history() returned %d ops" % (len(ops))) ops = list(a.history_reverse(opnum, opnum, use_block_num=False)) print("a.history_reverse() returned %d ops" % (len(ops))) ops = list(a.get_account_history(index=opnum+1, limit=opnum+1, start=opnum, stop=opnum, use_block_num=False)) print("a.get_account_history() returned %d ops" % (len(ops))) ``` Output: ``` # python getop.py 0 a.history() returned 1756 ops a.history_reverse() returned 1 ops a.get_account_history() returned 2 ops ``` The same for operation number 1 works: ``` # python getop.py 1 a.history() returned 1 ops a.history_reverse() returned 1 ops a.get_account_history() returned 1 ops ``` #### Environment ``` # beempy --version beempy, version 0.19.34 # python --version Python 3.6.5 ``` ### Possible fix `history()`, `history_reverse()`, and `get_account_history()` check for `if start` / `if stop` at several stages, however this check is `False` for both `None` and `0`. Changing those checks to `if start is not None` / `if stop is not None` could solve this: ``` # python getop.py.py 0 a.history() returned 1 ops a.history_reverse() returned 1 ops a.get_account_history() returned 1 ops # python getop.py.py 1 a.history() returned 1 ops a.history_reverse() returned 1 ops a.get_account_history() returned 1 ops ``` A PR has been created for these changes: https://github.com/holgern/beem/pull/19 However, please review these carefully, I'm not sure I covered all cases. The PR includes changes also to `account_history_reverse()`, which does not fail with the test above. #### GitHub Account https://github.com/crokkon A Github issue has been created: https://github.com/holgern/beem/issues/18
author | stmdev |
---|---|
permlink | beem-unable-to-get-only-the-first-op-via-account-history-and-account-getaccounthistory |
category | utopian-io |
json_metadata | {"tags":["utopian-io","bug-hunting","beem","python","steemdev"],"users":["holger80"],"links":["https://github.com/holgern/beem","https://github.com/holgern/beem/pull/19","https://github.com/crokkon","https://github.com/holgern/beem/issues/18"],"app":"steemit/0.1","format":"markdown"} |
created | 2018-06-01 13:53:00 |
last_update | 2018-06-01 13:53:00 |
depth | 0 |
children | 2 |
last_payout | 2018-06-08 13:53:00 |
cashout_time | 1969-12-31 23:59:59 |
total_payout_value | 27.829 HBD |
curator_payout_value | 9.008 HBD |
pending_payout_value | 0.000 HBD |
promoted | 0.000 HBD |
body_length | 2,438 |
author_reputation | 10,427,398,400,460 |
root_title | "Beem: unable to get only the first op via account.history() and account.get_account_history()" |
beneficiaries | [] |
max_accepted_payout | 1,000,000.000 HBD |
percent_hbd | 10,000 |
post_id | 58,761,124 |
net_rshares | 9,818,181,021,651 |
author_curate_reward | "" |
voter | weight | wgt% | rshares | pct | time |
---|---|---|---|---|---|
yuxi | 0 | 2,465,277,607 | 10% | ||
leir | 0 | 698,220,737 | 20% | ||
faisalamin | 0 | 6,609,784,473 | 100% | ||
utopian-io | 0 | 9,576,155,248,514 | 6.2% | ||
steemitstats | 0 | 3,268,686,383 | 5% | ||
holger80 | 0 | 213,707,094,681 | 75% | ||
josephace135 | 0 | 8,611,436,972 | 100% | ||
algo.coder | 0 | 3,054,161,665 | 50% | ||
fleshtestify | 0 | 605,136,851 | 100% | ||
awesomebinding | 0 | 605,136,851 | 100% | ||
shadytension | 0 | 605,133,886 | 100% | ||
intrusionpunish | 0 | 605,133,886 | 100% | ||
cogsenchant | 0 | 595,285,946 | 100% | ||
skimmingfind | 0 | 595,283,199 | 100% |
Thank you again for your contribution! I can confirm the found bug and accepted the [PR](https://github.com/holgern/beem/pull/19). Thanks for creating a github issue and a PR. Your contribution has been evaluated according to [Utopian policies and guidelines](https://join.utopian.io/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](https://review.utopian.io/result/5/2131113). ---- Need help? Write a ticket on https://support.utopian.io/. Chat with us on [Discord](https://discord.gg/uTyJkNm). [[utopian-moderator]](https://join.utopian.io/)
author | holger80 |
---|---|
permlink | re-stmdev-beem-unable-to-get-only-the-first-op-via-account-history-and-account-getaccounthistory-20180602t085653810z |
category | utopian-io |
json_metadata | {"tags":["utopian-io"],"links":["https://github.com/holgern/beem/pull/19","https://join.utopian.io/guidelines","https://review.utopian.io/result/5/2131113","https://support.utopian.io/","https://discord.gg/uTyJkNm","https://join.utopian.io/"],"app":"steemit/0.1"} |
created | 2018-06-02 08:57:03 |
last_update | 2018-06-02 08:57:03 |
depth | 1 |
children | 0 |
last_payout | 2018-06-09 08:57:03 |
cashout_time | 1969-12-31 23:59:59 |
total_payout_value | 0.000 HBD |
curator_payout_value | 0.000 HBD |
pending_payout_value | 0.000 HBD |
promoted | 0.000 HBD |
body_length | 668 |
author_reputation | 358,857,509,568,825 |
root_title | "Beem: unable to get only the first op via account.history() and account.get_account_history()" |
beneficiaries | [] |
max_accepted_payout | 1,000,000.000 HBD |
percent_hbd | 10,000 |
post_id | 58,880,743 |
net_rshares | 0 |
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>
author | utopian-io |
---|---|
permlink | re-beem-unable-to-get-only-the-first-op-via-account-history-and-account-getaccounthistory-20180602t142008z |
category | utopian-io |
json_metadata | "{"app": "beem/0.19.29"}" |
created | 2018-06-02 14:20:09 |
last_update | 2018-06-02 14:20:09 |
depth | 1 |
children | 0 |
last_payout | 2018-06-09 14:20:09 |
cashout_time | 1969-12-31 23:59:59 |
total_payout_value | 0.000 HBD |
curator_payout_value | 0.000 HBD |
pending_payout_value | 0.000 HBD |
promoted | 0.000 HBD |
body_length | 503 |
author_reputation | 152,955,367,999,756 |
root_title | "Beem: unable to get only the first op via account.history() and account.get_account_history()" |
beneficiaries | [] |
max_accepted_payout | 1,000,000.000 HBD |
percent_hbd | 10,000 |
post_id | 58,913,570 |
net_rshares | 0 |