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.ops() performs two calls of 'get_dynamic_global_properties' for each get_block call #82

Closed
bitphage opened this issue Mar 7, 2019 · 2 comments

Comments

@bitphage
Copy link
Contributor

bitphage commented Mar 7, 2019

Example requests logged:

{'method': 'call', 'params': ['database_api', 'get_config', []], 'jsonrpc': '2.0', 'id': 1}
{'method': 'call', 'params': ['database_api', 'get_dynamic_global_properties', []], 'jsonrpc': '2.0', 'id': 2}
{'method': 'call', 'params': ['database_api', 'get_dynamic_global_properties', []], 'jsonrpc': '2.0', 'id': 3}
{'method': 'call', 'params': ['database_api', 'get_dynamic_global_properties', []], 'jsonrpc': '2.0', 'id': 4}
{'method': 'call', 'params': ['database_api', 'get_block', [4556896]], 'jsonrpc': '2.0', 'id': 5}
{'block_num': 4556896,
 'op': ['award',
        {'beneficiaries': [{'account': 'pom', 'weight': 500},
                           {'account': 'u68.pom', 'weight': 5000}],
         'custom_sequence': 0,
         'energy': 500,
         'initiator': 'u68.pom',
         'memo': 'Награда за сообщение в чате Telegram: CRYPTOKOT',
         'receiver': 'u117.pom'}],
 'timestamp': '2019-03-07T11:21:21'}
{'method': 'call', 'params': ['database_api', 'get_dynamic_global_properties', []], 'jsonrpc': '2.0', 'id': 6}
{'method': 'call', 'params': ['database_api', 'get_dynamic_global_properties', []], 'jsonrpc': '2.0', 'id': 7}
{'method': 'call', 'params': ['database_api', 'get_block', [4556897]], 'jsonrpc': '2.0', 'id': 8}
{'method': 'call', 'params': ['database_api', 'get_dynamic_global_properties', []], 'jsonrpc': '2.0', 'id': 9}
{'method': 'call', 'params': ['database_api', 'get_dynamic_global_properties', []], 'jsonrpc': '2.0', 'id': 10}
{'method': 'call', 'params': ['database_api', 'get_block', [4556898]], 'jsonrpc': '2.0', 'id': 11}
{'method': 'call', 'params': ['database_api', 'get_dynamic_global_properties', []], 'jsonrpc': '2.0', 'id': 12}
{'method': 'call', 'params': ['database_api', 'get_dynamic_global_properties', []], 'jsonrpc': '2.0', 'id': 13}
{'method': 'call', 'params': ['database_api', 'get_block', [4556899]], 'jsonrpc': '2.0', 'id': 14}
{'method': 'call', 'params': ['database_api', 'get_dynamic_global_properties', []], 'jsonrpc': '2.0', 'id': 15}
{'method': 'call', 'params': ['database_api', 'get_dynamic_global_properties', []], 'jsonrpc': '2.0', 'id': 16}
{'method': 'call', 'params': ['database_api', 'get_block', [4556900]], 'jsonrpc': '2.0', 'id': 17}
{'method': 'call', 'params': ['database_api', 'get_dynamic_global_properties', []], 'jsonrpc': '2.0', 'id': 18}
{'method': 'call', 'params': ['database_api', 'get_dynamic_global_properties', []], 'jsonrpc': '2.0', 'id': 19}
{'method': 'call', 'params': ['database_api', 'get_block', [4556901]], 'jsonrpc': '2.0', 'id': 20}

Stefan said he implement a solution in bexi https://github.com/blockchainbv/bexi/blob/master/bexi/blockchain_monitor/__init__.py

@bitphage
Copy link
Contributor Author

bitphage commented Mar 7, 2019

  1. We need to perform 'get_dynamic_global_properties' to make sure irreversible block advance. So one call of 'get_dynamic_global_properties' inevitable with "irreversible" mode. For "head" mode, it may be omitted too.
  2. When calling blocks(start=some_old_block we don't need to call self.get_current_block_num() on each block because we already know current irreversible block, thus we can bypass this call until we get to this block.

bitphage added a commit to VIZ-Blockchain/viz-python-lib that referenced this issue Mar 7, 2019
graphenecommon.Blockchain.ops() method is unoptimal (see
xeroc/python-graphenelib#82) and doesn't
provide similar functionality.

Our stream() method from https://github.com/bitfag/golos-python is more
handy because it can stream both real and virtual ops.
@xeroc
Copy link
Owner

xeroc commented Mar 25, 2019

pinging @sschiessl-bcp

xeroc added a commit that referenced this issue Mar 25, 2019
xeroc added a commit that referenced this issue Mar 27, 2019
Release 0.1.3

ef556dd (HEAD -> master) Merge branch 'release/0.1.13'
ed5074f (release/0.1.13) Update Makefile
1dfd8a8 Update authors
f06ef88 Update docs
78227ba version bump
78ac7fb (origin/develop, develop) Allow to get operation name more generally #79
7fa32cc Merge pull request #78 from bitfag/tip-block-interval-separate-method
e03e0fc Merge pull request #90 from xeroc/pyup-scheduled-update-2019-03-25
e1e1d42 Update pycryptodome from 3.7.3 to 3.8.0
3ac0ba0 Update websocket-client from 0.55.0 to 0.56.0
e4c7450 Update isort from 4.3.15 to 4.3.16
16b855a Fix requirements
1acbb61 Add scrypt as dependency as it is used for ecnrypted storage
5136310 Disable block caching by default
a1e3ac9 Fix #81
740f959 Cache chain parameters #82
6f09112 Allow to overwrite permissions #85
bfd6d6c fix #87
1326d57 Fix #89
b263427 Merge pull request #88 from xeroc/pyup-scheduled-update-2019-03-18
f08ca53 (origin/pyup-scheduled-update-2019-03-18) Update pylibscrypt from 1.7.1 to 1.8.0
b324d16 Update pyyaml from 3.13 to 5.1
f0e5069 Update isort from 4.3.12 to 4.3.15
9b95aae Update coverage from 4.5.2 to 4.5.3
b493919 Update pytest from 4.3.0 to 4.3.1
c697a37 Update graphenelib from 1.1.11 to 1.1.12
1893860 Merge tag '1.1.12' into develop
8150fd1 Move getting of block interval into separate method
@xeroc xeroc closed this as completed May 13, 2022
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