Skip to content

Commit

Permalink
Merge pull request #1639 from cyyber/dev
Browse files Browse the repository at this point in the history
Fix: Block deserialized by the content of BlockNumberMapping resulting into a blank Block
  • Loading branch information
cyyber authored Nov 7, 2019
2 parents 2545b66 + 92c8e7d commit 55aa97d
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/qrl/services/PublicAPIService.py
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,8 @@ def GetObject(self, request: qrl_pb2.GetObjectReq, context) -> qrl_pb2.GetObject
# NOTE: This is temporary, indexes are accepted for blocks
try:
block = self.qrlnode.get_block_from_hash(query)
if block is None:
# The condition after or is to avoid a bug, where a block is deserialized by BlockNumberMapping
if block is None or (block.block_number == 0 and block.prev_headerhash != config.user.genesis_prev_headerhash):
query_str = query.decode()
query_index = int(query_str)
block = self.qrlnode.get_block_from_index(query_index)
Expand Down

0 comments on commit 55aa97d

Please sign in to comment.