whitespace, variable rename

This commit is contained in:
The MMGen Project 2026-06-04 10:41:37 +00:00
commit 0c8794ad35
Signed by: mmgen
GPG key ID: 3F8B1861E32B7DA2
2 changed files with 13 additions and 13 deletions

View file

@ -143,12 +143,13 @@ class BipHDConfig(Lockable):
if not coin.lower() in self.supported_coins:
raise ValueError(f'bip_hd: coin {coin.upper()} not supported')
base_cfg = Config({
'_clone': base_cfg,
'coin': coin,
'network': network,
'type': addr_type or None,
'quiet': True})
base_cfg = Config(
cfg = {
'_clone': base_cfg,
'coin': coin,
'network': network,
'type': addr_type or None,
'quiet': True})
dfl_type = base_cfg._proto.dfl_mmtype
addr_type = MMGenAddrType(
@ -276,8 +277,7 @@ class BipHDNode(Lockable):
pubkey_type = self.cfg.addr_type.pubkey_type,
compressed = self.cfg.addr_type.compressed)
if self.public else
self.priv2pub()
)
self.priv2pub())
# Extended keys can be identified by the Hash160 (RIPEMD160 after SHA256) of the serialized ECDSA
# public key K, ignoring the chain code. This corresponds exactly to the data used in traditional

View file

@ -78,20 +78,20 @@ class mainnet(CoinProtocol.Secp256k1): # chainparams.cpp
def decode_wif(self, wif):
key_data = b58chk_decode(wif)
vlen = self.wif_ver_bytes_len or self.get_wif_ver_bytes_len(key_data)
key = key_data[vlen:]
sec_bytes = key_data[vlen:]
match len(key):
match len(sec_bytes):
case x if x == self.privkey_len + 1:
assert key[-1] == 0x01, f'{key[-1]!r}: invalid compressed key suffix byte'
assert sec_bytes[-1] == 0x01, f'{sec_bytes[-1]!r}: invalid compressed key suffix byte'
case self.privkey_len:
pass
case x:
raise ValueError(f'{x}: invalid key length')
return decoded_wif(
sec = key[:self.privkey_len],
sec = sec_bytes[:self.privkey_len],
pubkey_type = self.wif_ver_bytes_to_pubkey_type[key_data[:vlen]],
compressed = len(key) == self.privkey_len + 1)
compressed = len(sec_bytes) == self.privkey_len + 1)
def decode_addr(self, addr):