proto.bytes2wif() -> proto.encode_wif()

This commit is contained in:
The MMGen Project 2022-10-03 09:59:58 +00:00
commit d1572154b9
Signed by: mmgen
GPG key ID: 3F8B1861E32B7DA2
3 changed files with 3 additions and 3 deletions

View file

@ -103,7 +103,7 @@ class PrivKey(bytes,Hilite,InitErrors,MMGenObject):
assert type(compressed) == bool,(
f"'compressed' must be of type bool, not {type(compressed).__name__}" )
me = bytes.__new__( cls, proto.preprocess_key(s,pubkey_type) )
me.wif = WifKey( proto, proto.bytes2wif(me,pubkey_type,compressed) )
me.wif = WifKey( proto, proto.encode_wif(me,pubkey_type,compressed) )
me.compressed = compressed
me.pubkey_type = pubkey_type
me.orig_bytes = s # save the non-preprocessed key

View file

@ -50,7 +50,7 @@ class mainnet(CoinProtocol.Secp256k1): # chainparams.cpp
ignore_daemon_version = False
max_int = 0xffffffff
def bytes2wif(self,privbytes,pubkey_type,compressed): # input is preprocessed hex
def encode_wif(self,privbytes,pubkey_type,compressed): # input is preprocessed hex
assert len(privbytes) == self.privkey_len, f'{len(privbytes)} bytes: incorrect private key length!'
assert pubkey_type in self.wif_ver_num, f'{pubkey_type!r}: invalid pubkey_type'
return b58chk_encode(

View file

@ -189,7 +189,7 @@ class CoinProtocol(MMGenObject):
"""
Ethereum and Monero protocols inherit from this class
"""
def bytes2wif(self,privbytes,pubkey_type,compressed):
def encode_wif(self,privbytes,pubkey_type,compressed):
assert pubkey_type == self.pubkey_type, f'{pubkey_type}: invalid pubkey_type for {self.name} protocol!'
assert compressed == False, f'{self.name} protocol does not support compressed pubkeys!'
return privbytes.hex()