From 8da73ad3dd7756ad4b5ccdfefb1a3e2a38ac5564 Mon Sep 17 00:00:00 2001
From: Jack Robison <jackrobison@lbry.io>
Date: Tue, 8 Dec 2020 14:42:28 -0500
Subject: [PATCH] improve hash_to_hex_str performance

---
 lbry/wallet/server/hash.py | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/lbry/wallet/server/hash.py b/lbry/wallet/server/hash.py
index a1a5d8068..2c0201952 100644
--- a/lbry/wallet/server/hash.py
+++ b/lbry/wallet/server/hash.py
@@ -67,17 +67,17 @@ def hash160(x):
     return ripemd160(sha256(x))
 
 
-def hash_to_hex_str(x):
+def hash_to_hex_str(x: bytes) -> str:
     """Convert a big-endian binary hash to displayed hex string.
 
     Display form of a binary hash is reversed and converted to hex.
     """
-    return bytes(reversed(x)).hex()
+    return x[::-1].hex()
 
 
-def hex_str_to_hash(x):
+def hex_str_to_hash(x: str) -> bytes:
     """Convert a displayed hex string to a binary hash."""
-    return bytes(reversed(hex_to_bytes(x)))
+    return hex_to_bytes(x)[::-1]
 
 
 class Base58Error(Exception):