diff --git a/core/src/apps/common/coininfo.py b/core/src/apps/common/coininfo.py index a752fd531d..4ced81a933 100644 --- a/core/src/apps/common/coininfo.py +++ b/core/src/apps/common/coininfo.py @@ -68,7 +68,7 @@ class CoinInfo: if curve_name == "secp256k1-groestl": self.b58_hash = groestl512d_32 self.sign_hash_double = False - self.script_hash: type[utils.HashContext] = sha256_ripemd160 + self.script_hash: type[utils.HashContextInitable] = sha256_ripemd160 elif curve_name == "secp256k1-decred": self.b58_hash = blake256d_32 self.sign_hash_double = False diff --git a/core/src/apps/common/coininfo.py.mako b/core/src/apps/common/coininfo.py.mako index d18adb0175..03b761f00c 100644 --- a/core/src/apps/common/coininfo.py.mako +++ b/core/src/apps/common/coininfo.py.mako @@ -68,7 +68,7 @@ class CoinInfo: if curve_name == "secp256k1-groestl": self.b58_hash = groestl512d_32 self.sign_hash_double = False - self.script_hash: type[utils.HashContext] = sha256_ripemd160 + self.script_hash: type[utils.HashContextInitable] = sha256_ripemd160 elif curve_name == "secp256k1-decred": self.b58_hash = blake256d_32 self.sign_hash_double = False diff --git a/core/src/trezor/utils.py b/core/src/trezor/utils.py index df091bdde3..168f29de75 100644 --- a/core/src/trezor/utils.py +++ b/core/src/trezor/utils.py @@ -145,17 +145,18 @@ def chunks_intersperse(items: str, size: int, sep: str = "\n") -> Iterator[str]: if TYPE_CHECKING: class HashContext(Protocol): - def __init__( # pylint: disable=super-init-not-called - self, __data: bytes = None - ) -> None: - ... - def update(self, __buf: bytes) -> None: ... def digest(self) -> bytes: ... + class HashContextInitable(HashContext, Protocol): + def __init__( # pylint: disable=super-init-not-called + self, __data: bytes = None + ) -> None: + ... + class Writer(Protocol): def append(self, __b: int) -> None: ...