override_globals_from_cfg_file(): set class, not instance, attr in proto

Fixes a critical bug that led to coin-specific vars in cfg file being ignored.
This commit is contained in:
The MMGen Project 2021-02-25 16:06:56 +03:00
commit fef1d509a5
Signed by: mmgen
GPG key ID: 3F8B1861E32B7DA2

View file

@ -130,10 +130,10 @@ def override_globals_from_cfg_file(ucfg):
ns = d.name.split('_')
if ns[0] in CoinProtocol.coins:
nse,tn = (ns[2:],True) if len(ns) > 2 and ns[1] == 'testnet' else (ns[1:],False)
cls = init_proto(ns[0],tn)
cls = type(init_proto(ns[0],tn)) # no instance yet, so override _class_ attr
attr = '_'.join(nse)
else:
cls = g
cls = g # g is "singleton" instance, so override _instance_ attr
attr = d.name
refval = getattr(cls,attr)
if type(refval) is dict and type(val) is str: # hack - catch single colon-separated value