Skip to content

Commit

Permalink
Return rpc.delegators() voting weights as integers instead of strings
Browse files Browse the repository at this point in the history
  • Loading branch information
dourvaris committed Feb 10, 2018
1 parent 31dd078 commit b9daf82
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 8 deletions.
6 changes: 5 additions & 1 deletion raiblocks/rpc.py
Expand Up @@ -1267,8 +1267,12 @@ def delegators(self, account):
}

resp = self.call('delegators', payload)
delegators = resp.get('delegators') or {}

return resp.get('delegators') or {}
for k, v in delegators.items():
delegators[k] = int(v)

return delegators

@doc_metadata(categories=['account'])
def delegators_count(self, account):
Expand Down
14 changes: 7 additions & 7 deletions tests/fixtures/rpc/delegators.json
Expand Up @@ -2,18 +2,18 @@
{
"args": {
"account": "xrb_1111111111111111111111111111111111111111111111111117353trpda"
},
},
"expected": {
"xrb_13bqhi1cdqq8yb9szneoc38qk899d58i5rcrgdk5mkdm86hekpoez3zxw5sd": "500000000000000000000000000000000000",
"xrb_17k6ug685154an8gri9whhe5kb5z1mf5w6y39gokc1657sh95fegm8ht1zpn": "961647970820730000000000000000000000"
},
"xrb_13bqhi1cdqq8yb9szneoc38qk899d58i5rcrgdk5mkdm86hekpoez3zxw5sd": 500000000000000000000000000000000000,
"xrb_17k6ug685154an8gri9whhe5kb5z1mf5w6y39gokc1657sh95fegm8ht1zpn": 961647970820730000000000000000000000
},
"request": {
"account": "xrb_1111111111111111111111111111111111111111111111111117353trpda",
"account": "xrb_1111111111111111111111111111111111111111111111111117353trpda",
"action": "delegators"
},
},
"response": {
"delegators": {
"xrb_13bqhi1cdqq8yb9szneoc38qk899d58i5rcrgdk5mkdm86hekpoez3zxw5sd": "500000000000000000000000000000000000",
"xrb_13bqhi1cdqq8yb9szneoc38qk899d58i5rcrgdk5mkdm86hekpoez3zxw5sd": "500000000000000000000000000000000000",
"xrb_17k6ug685154an8gri9whhe5kb5z1mf5w6y39gokc1657sh95fegm8ht1zpn": "961647970820730000000000000000000000"
}
}
Expand Down

0 comments on commit b9daf82

Please sign in to comment.