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

Use pagenation on getting assets in get_normalized_balances. #30

Draft
wants to merge 1 commit into
base: monaparty-develop
Choose a base branch
from

Conversation

cryptcoin-junkey
Copy link
Member

@cryptcoin-junkey cryptcoin-junkey commented Sep 16, 2021

Signed-off-by: Cryptcoin Junkey [email protected]

fixes #29

@cryptcoin-junkey
Copy link
Member Author

curl localhost:4100 --data-binary '{ "jsonrpc": "2.0", "method": "get_normalized_balances", "params": { "addresses": ["MLJ11FmnsikavGbcHm9HpfgcPhA81NdBzM"]}, "id": 1 }' | jq . | grep _quantity | wc -l
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100  279k  100  279k  100   132   380k    179 --:--:-- --:--:-- --:--:--  380k
1701

After applied this patch, we can get all (more than 1000) balances that Monapa-chan has.

@codecov
Copy link

codecov bot commented Sep 16, 2021

Codecov Report

Merging #30 (fa8350e) into monaparty-develop (0b94e65) will decrease coverage by 0.00%.
The diff coverage is 0.00%.

Impacted file tree graph

@@                 Coverage Diff                  @@
##           monaparty-develop     #30      +/-   ##
====================================================
- Coverage               3.95%   3.94%   -0.01%     
====================================================
  Files                     30      30              
  Lines                   3973    3981       +8     
====================================================
  Hits                     157     157              
- Misses                  3816    3824       +8     
Impacted Files Coverage Δ
counterblock/lib/modules/assets.py 0.00% <0.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 0b94e65...fa8350e. Read the comment docs.

@anipopina
Copy link

どうしても気になってしまったためコメントで失礼します。
地味なのですが result = result + sub の後に if len(sub) < size: でbreakしてあげるようにすれば、多くの場合においてget_balancesを1回減らせると思いました。

@cryptcoin-junkey
Copy link
Member Author

@anipopina ご指摘はそのとおりなのですが、#29 でのコメントの通り、それなりの規模で書き換える前提で作業にはいっており、現時点では最適化は考慮していません。

@cryptcoin-junkey cryptcoin-junkey marked this pull request as draft September 16, 2021 07:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

Failed to get XMP balance.
2 participants