def bx_block_to_block(self, bx_block_msg, tx_service) -> BlockDecompressionResult: start_datetime = datetime.datetime.utcnow() start_time = time.time() block_msg = BlockBtcMessage(buf=bx_block_msg) block_info = BlockInfo( block_msg.block_hash(), [], start_datetime, datetime.datetime.utcnow(), (time.time() - start_time) * 1000, block_msg.txn_count(), # pyre-fixme[6]: Expected `Optional[str]` for 7th param but got # `BtcObjectHash`. block_msg.block_hash(), convert.bytes_to_hex(block_msg.prev_block_hash().binary), len(block_msg.rawbytes()), len(block_msg.rawbytes()), 0 ) return BlockDecompressionResult(block_msg, block_info, [], [])
def get_previous_block_hash_from_message( self, block_message: BlockBtcMessage) -> Sha256Hash: return block_message.prev_block_hash()