Skip to content

Commit

Permalink
Problem: migrated key related log breaks json.loads
Browse files Browse the repository at this point in the history
  • Loading branch information
mmsqe committed Jan 4, 2024
1 parent 1c35155 commit e4b7519
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 14 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
- [#104](https://github.com/crypto-com/pystarport/pull/104) support json_rpc_addr in relayer config
- [#109](https://github.com/crypto-com/pystarport/pull/109) add feegrants in relayer config
- [#110](https://github.com/crypto-com/pystarport/pull/110) add event_query_tx_for to allow subscribe and wait for transaction.
- [#112](https://github.com/crypto-com/pystarport/pull/112) avoid migrated key related log breaks json.loads in gov_vote.

*Feb 7, 2023*

Expand Down
31 changes: 17 additions & 14 deletions pystarport/cosmoscli.py
Original file line number Diff line number Diff line change
Expand Up @@ -786,21 +786,24 @@ def gov_vote(self, voter, proposal_id, option, event_query_tx=True):
print(voter)
print(proposal_id)
print(option)
rsp = json.loads(
self.raw(
"tx",
"gov",
"vote",
proposal_id,
option,
"-y",
from_=voter,
home=self.data_dir,
node=self.node_rpc,
keyring_backend="test",
chain_id=self.chain_id,
)
raw = self.raw(
"tx",
"gov",
"vote",
proposal_id,
option,
"-y",
from_=voter,
home=self.data_dir,
node=self.node_rpc,
keyring_backend="test",
chain_id=self.chain_id,
output="json",
)
# skip success log info that breaks json.loads
brace_index = raw.index(b"{")
json_part = raw[brace_index:]
rsp = json.loads(json_part)
if rsp["code"] == 0 and event_query_tx:
rsp = self.event_query_tx_for(rsp["txhash"])
return rsp
Expand Down

0 comments on commit e4b7519

Please sign in to comment.