def hex_str_to_hash(x): '''Convert a displayed hex string to a binary hash.''' return bytes(reversed(hex_to_bytes(x)))
async def raw_blocks(self, hex_hashes): '''Return the raw binary blocks with the given hex hashes.''' params_iterable = ((h, False) for h in hex_hashes) blocks = await self._send_vector('getblock', params_iterable) # Convert hex string to bytes return [hex_to_bytes(self.strip_mtp_data(block)) for block in blocks]
def test_hex_transforms(): h = "AABBCCDDEEFF" assert util.hex_to_bytes(h) == b'\xaa\xbb\xcc\xdd\xee\xff'