From 9320b83e546f4c6b7fd74f12eab3983284ad3e03 Mon Sep 17 00:00:00 2001 From: cyyber Date: Mon, 23 Mar 2020 09:52:04 +0530 Subject: [PATCH 1/3] Fix for GetVoteStats API --- src/qrl/core/ChainManager.py | 2 +- src/qrl/core/qrlnode.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/qrl/core/ChainManager.py b/src/qrl/core/ChainManager.py index dc6471a5c..000ec782b 100644 --- a/src/qrl/core/ChainManager.py +++ b/src/qrl/core/ChainManager.py @@ -221,7 +221,7 @@ def get_inbox_message_transaction_hashes(self, address: bytes, item_index: int) with self.lock: return p.get_paginated_data(address, item_index) - def get_vote_stats(self, multi_sig_spend_txn_hash: bytes): + def get_vote_stats(self, multi_sig_spend_txn_hash: bytes) -> VoteStats: with self.lock: return VoteStats.get_state(state=self._state, shared_key=multi_sig_spend_txn_hash) diff --git a/src/qrl/core/qrlnode.py b/src/qrl/core/qrlnode.py index 005bbffeb..adeb86ba8 100644 --- a/src/qrl/core/qrlnode.py +++ b/src/qrl/core/qrlnode.py @@ -666,7 +666,7 @@ def get_multi_sig_spend_txs_by_address(self, def get_vote_stats(self, multi_sig_spend_tx_hash: bytes): vote_stats = self._chain_manager.get_vote_stats(multi_sig_spend_tx_hash) - return qrl_pb2.GetVoteStatsResp(vote_stats=vote_stats) + return qrl_pb2.GetVoteStatsResp(vote_stats=vote_stats.pbdata) def get_inbox_messages_by_address(self, address: bytes, item_per_page: int, page_number: int): if item_per_page == 0: From d004387574da5731295027ccf1da58a610ba65ea Mon Sep 17 00:00:00 2001 From: Cyyber Ttechno Date: Mon, 23 Mar 2020 21:20:18 +0530 Subject: [PATCH 2/3] Fix: Added missing property decorated in VoteStats --- src/qrl/core/VoteStats.py | 1 + 1 file changed, 1 insertion(+) diff --git a/src/qrl/core/VoteStats.py b/src/qrl/core/VoteStats.py index 88b0692f6..21b39d224 100644 --- a/src/qrl/core/VoteStats.py +++ b/src/qrl/core/VoteStats.py @@ -14,6 +14,7 @@ def __init__(self, protobuf_block=None): if protobuf_block is None: self._data = qrl_pb2.VoteStats() + @property def pbdata(self): return self._data From b0e34146feb58a3778d37b5b34b89c91d6d61dd4 Mon Sep 17 00:00:00 2001 From: cyyber Date: Mon, 30 Mar 2020 10:16:14 +0530 Subject: [PATCH 3/3] API Fix get_ots --- src/qrl/core/qrlnode.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/qrl/core/qrlnode.py b/src/qrl/core/qrlnode.py index adeb86ba8..5052fe1dc 100644 --- a/src/qrl/core/qrlnode.py +++ b/src/qrl/core/qrlnode.py @@ -407,10 +407,10 @@ def get_ots(self, max_bitfield = 2 ** OptimizedAddressState.get_height_from_address(address) max_pages = (max_bitfield // config.dev.ots_tracking_per_page) + 1 page_from = min(page_from, max_pages) - max_pages = min(page_from + page_count, max_pages) + max_pages = min(page_from + page_count - 1, max_pages) bitfields = list() - for page in range(page_from, max_pages): + for page in range(page_from, max_pages + 1): bitfield = self._chain_manager.get_bitfield(address, page) bitfields.append(qrl_pb2.OTSBitfieldByPage(ots_bitfield=bitfield, page_number=page))