Browse Source

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.
The MMGen Project 4 years ago
parent
commit
fef1d509a5
1 changed files with 2 additions and 2 deletions
  1. 2 2
      mmgen/opts.py

+ 2 - 2
mmgen/opts.py

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