theQRL / QRL

Quantum Resistant Ledger
https://theqrl.org/
MIT License
417 stars 109 forks source link

GetVoteStats API not returning a qrl.VoteStatsResp object #1692

Closed som-dev closed 4 years ago

som-dev commented 4 years ago

Running qrl node 0.2.0 off dev branch and testnet. I cannot successfully call GetVoteStats() with what I believe to be a properly populated GetVoteStatsReq object.

The error in my local node suggests the response is getting assigned an instance of the QRL VoteStats object instead of a pbdata VoteStatsResp object:

2020-03-22 22:15:30,070|0.2.0+44.g78c2815b.dirty python|synced |ThreadPoolExecutor-0_0| ERROR : Traceback (most recent call last): File "/home/sysop/dev/theqrl/QRL/src/qrl/services/grpcHelper.py", line 25, in wrap_f return f(caller_self, request, context) File "/home/sysop/dev/theqrl/QRL/src/qrl/services/PublicAPIService.py", line 502, in GetVoteStats return self.qrlnode.get_vote_stats(request.multi_sig_spend_tx_hash) File "/home/sysop/dev/theqrl/QRL/src/qrl/core/qrlnode.py", line 669, in get_vote_stats return qrl_pb2.GetVoteStatsResp(vote_stats=vote_stats) TypeError: Parameter to MergeFrom() must be instance of same class: expected qrl.VoteStats got VoteStats.

cyyber commented 4 years ago

Fixed in PR #1693 . It will be available on next release.

som-dev commented 4 years ago

I pulled dev and tried the query again but I still see an error on my local server, although with a different reason (note the traceback has the new vote_stats=vote_stats.pbdata):

2020-03-23 10:17:01,296|2.0.0+2.gb90d2190.dirty python|synced |ThreadPoolExecutor-0_0| ERROR : Traceback (most recent call last): File "/home/sysop/dev/theqrl/QRL/src/qrl/services/grpcHelper.py", line 25, in wrap_f return f(caller_self, request, context) File "/home/sysop/dev/theqrl/QRL/src/qrl/services/PublicAPIService.py", line 502, in GetVoteStats return self.qrlnode.get_vote_stats(request.multi_sig_spend_tx_hash) File "/home/sysop/dev/theqrl/QRL/src/qrl/core/qrlnode.py", line 669, in get_vote_stats return qrl_pb2.GetVoteStatsResp(vote_stats=vote_stats.pbdata) TypeError: Parameter to MergeFrom() must be instance of same class: expected qrl.VoteStats got method.

cyyber commented 4 years ago

Thanks for reporting. PR #1694 should have fixed the above issue.

som-dev commented 4 years ago

pulled latest dev and it works, thanks!

cyyber commented 4 years ago

Thanks for reporting and testing the fixes.