Ejemplo n.º 1
0
 async def get_blockchain_state(self) -> Dict:
     response = await self.fetch("get_blockchain_state", {})
     if response["blockchain_state"]["peak"] is not None:
         response["blockchain_state"][
             "peak"] = SubBlockRecord.from_json_dict(
                 response["blockchain_state"]["peak"])
     return response["blockchain_state"]
 async def get_sub_block_record_by_sub_height(
         self, sub_height) -> Optional[SubBlockRecord]:
     try:
         response = await self.fetch("get_sub_block_record_by_sub_height",
                                     {"sub_height": sub_height})
     except Exception:
         return None
     return SubBlockRecord.from_json_dict(response["sub_block_record"])
 async def get_sub_block_record(self,
                                header_hash) -> Optional[SubBlockRecord]:
     try:
         response = await self.fetch("get_sub_block_record",
                                     {"header_hash": header_hash.hex()})
         if response["sub_block_record"] is None:
             return None
     except Exception:
         return None
     return SubBlockRecord.from_json_dict(response["sub_block_record"])