MMGenPasswordType: initialize all unused fields with 'None'
This commit is contained in:
parent
28ff467eee
commit
c1ba807502
2 changed files with 11 additions and 10 deletions
|
|
@ -311,6 +311,7 @@ class AddrListChksum(str,Hilite):
|
|||
|
||||
def __new__(cls,addrlist):
|
||||
ea = addrlist.al_id.mmtype.extra_attrs # add viewkey and passwd to the mix, if present
|
||||
if ea == None: ea = ()
|
||||
lines = [' '.join(
|
||||
addrlist.chksum_rec_f(e) +
|
||||
tuple(getattr(e,a) for a in ea if getattr(e,a))
|
||||
|
|
|
|||
20
mmgen/obj.py
20
mmgen/obj.py
|
|
@ -732,17 +732,17 @@ class PrivKey(str,Hilite,InitErrors,MMGenObject):
|
|||
return cls.init_fail(e,s,objname='{} WIF key'.format(g.coin))
|
||||
else:
|
||||
try:
|
||||
assert s,'private key hex data missing'
|
||||
assert compressed is not None, "'compressed' arg missing"
|
||||
assert s,'private key bin data missing'
|
||||
assert pubkey_type is not None,"'pubkey_type' arg missing"
|
||||
assert type(compressed) == bool,"{!r}: 'compressed' not of type 'bool'".format(compressed)
|
||||
assert len(s) == cls.width // 2,'key length must be {}'.format(cls.width // 2)
|
||||
if pubkey_type == 'password': # skip WIF creation and pre-processing for passwds
|
||||
me = str.__new__(cls,s.hex())
|
||||
else:
|
||||
assert compressed is not None, "'compressed' arg missing"
|
||||
assert type(compressed) == bool,"{!r}: 'compressed' not of type 'bool'".format(compressed)
|
||||
me = str.__new__(cls,g.proto.preprocess_key(s.hex(),pubkey_type))
|
||||
me.wif = WifKey(g.proto.hex2wif(me,pubkey_type,compressed),on_fail='raise')
|
||||
me.compressed = compressed
|
||||
me.compressed = compressed
|
||||
me.pubkey_type = pubkey_type
|
||||
me.orig_hex = s.hex() # save the non-preprocessed key
|
||||
return me
|
||||
|
|
@ -858,11 +858,11 @@ class MMGenAddrType(str,Hilite,InitErrors,MMGenObject):
|
|||
|
||||
name = MMGenImmutableAttr('name',str)
|
||||
pubkey_type = MMGenImmutableAttr('pubkey_type',str)
|
||||
compressed = MMGenImmutableAttr('compressed',bool)
|
||||
gen_method = MMGenImmutableAttr('gen_method',str)
|
||||
addr_fmt = MMGenImmutableAttr('addr_fmt',str)
|
||||
wif_label = MMGenImmutableAttr('wif_label',str)
|
||||
extra_attrs = MMGenImmutableAttr('extra_attrs',tuple)
|
||||
compressed = MMGenImmutableAttr('compressed',bool,set_none_ok=True)
|
||||
gen_method = MMGenImmutableAttr('gen_method',str,set_none_ok=True)
|
||||
addr_fmt = MMGenImmutableAttr('addr_fmt',str,set_none_ok=True)
|
||||
wif_label = MMGenImmutableAttr('wif_label',str,set_none_ok=True)
|
||||
extra_attrs = MMGenImmutableAttr('extra_attrs',tuple,set_none_ok=True)
|
||||
desc = MMGenImmutableAttr('desc',str)
|
||||
|
||||
mmtypes = {
|
||||
|
|
@ -900,5 +900,5 @@ class MMGenAddrType(str,Hilite,InitErrors,MMGenObject):
|
|||
|
||||
class MMGenPasswordType(MMGenAddrType):
|
||||
mmtypes = {
|
||||
'P': ati('password', 'password', False, None, None, None, (), 'Password generated from MMGen seed')
|
||||
'P': ati('password', 'password', None, None, None, None, None, 'Password generated from MMGen seed')
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue