async def getrawtransactions(self, hex_hashes, replace_errs=True): """Return the serialized raw transactions with the given hashes. Replaces errors with None by default.""" params_iterable = ((hex_hash, 0) for hex_hash in hex_hashes) txs = await self._send_vector('getrawtransaction', params_iterable, replace_errs=replace_errs) # Convert hex strings to bytes return [hex_to_bytes(tx) if tx else None for tx in txs]
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(block) for block in blocks]
def hex_str_to_hash(x: str) -> bytes: """Convert a displayed hex string to a binary hash.""" return hex_to_bytes(x)[::-1]