chore(core): Add HashContextInitable protocol class.

matejcik/one-of
Andrew Kozlik 2 years ago committed by Andrew Kozlik
parent f17a435cdf
commit 83686d1be2

@ -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

@ -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

@ -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:
...

Loading…
Cancel
Save