addr.py,obj.py: minor changes

This commit is contained in:
The MMGen Project 2018-05-16 10:21:28 +00:00
commit dd1300d946
Signed by: mmgen
GPG key ID: 3F8B1861E32B7DA2
3 changed files with 10 additions and 9 deletions

View file

@ -43,4 +43,4 @@ the case, you must change your wallet password to an ASCII one (or export your
brainwallet to another MMGen wallet format) using an older version of MMGen
before upgrading.
[1]: ../../doc/README.mswin.md
[1]: /doc/README.mswin.md

View file

@ -436,12 +436,12 @@ Removed {{}} duplicate WIF key{{}} from keylist (also in {pnm} key-address file
e.sec = PrivKey(sha256(sha256(seed).digest()).digest(),compressed=compressed,pubkey_type=pubkey_type)
if self.gen_addrs:
ph = kg.to_pubhex(e.sec)
e.addr = ag.to_addr(ph)
pubhex = kg.to_pubhex(e.sec)
e.addr = ag.to_addr(pubhex)
if gen_viewkey:
e.viewkey = ag.to_viewkey(ph)
e.viewkey = ag.to_viewkey(pubhex)
if gen_wallet_passwd:
e.wallet_passwd = ag.to_wallet_passwd(ph)
e.wallet_passwd = ag.to_wallet_passwd(e.sec)
if type(self) == PasswordList:
e.passwd = unicode(self.make_passwd(e.sec)) # TODO - own type

View file

@ -745,12 +745,15 @@ class MMGenAddrType(str,Hilite,InitErrors,MMGenObject):
'compressed':False,
'gen_method':'zcash_z',
'addr_fmt':'zcash_z',
'extra_attrs': ('viewkey',),
'desc':'Zcash z-address' },
'M': { 'name':'monero',
'pubkey_type':'monero',
'compressed':False,
'gen_method':'monero',
'addr_fmt':'monero',
'wif_label':'spendkey:',
'extra_attrs': ('viewkey','wallet_passwd'),
'desc':'Monero address'}
}
def __new__(cls,s,on_fail='die',errmsg=None):
@ -766,10 +769,8 @@ class MMGenAddrType(str,Hilite,InitErrors,MMGenObject):
setattr(me,k,v[k])
assert me in g.proto.mmtypes + ('P',), (
"'{}': invalid address type for {}".format(me.name,g.proto.__name__))
me.extra_attrs = []
if me.name in ('monero','zcash_z'): me.extra_attrs += ['viewkey']
if me.name == 'monero': me.extra_attrs += ['wallet_passwd']
me.wif_label = ('wif:','spendkey:')[me.name=='monero']
me.extra_attrs = v['extra_attrs'] if 'extra_attrs' in v else ()
me.wif_label = v['wif_label'] if 'wif_label' in v else 'wif:'
return me
raise ValueError,'not found'
except Exception as e: