Browse Source

global var rename: g.rpch -> g.rpc

The MMGen Project 4 years ago
parent
commit
78a199c1a6

+ 5 - 5
mmgen/addr.py

@@ -1050,12 +1050,12 @@ re-import your addresses.
 	@classmethod
 	def get_tw_data(cls,wallet=None):
 		vmsg('Getting address data from tracking wallet')
-		if 'label_api' in g.rpch.caps:
-			accts = g.rpch.listlabels()
-			alists = [list(a.keys()) for a in g.rpch.getaddressesbylabel([[k] for k in accts],batch=True)]
+		if 'label_api' in g.rpc.caps:
+			accts = g.rpc.listlabels()
+			alists = [list(a.keys()) for a in g.rpc.getaddressesbylabel([[k] for k in accts],batch=True)]
 		else:
-			accts = g.rpch.listaccounts(0,True)
-			alists = g.rpch.getaddressesbyaccount([[k] for k in accts],batch=True)
+			accts = g.rpc.listaccounts(0,True)
+			alists = g.rpc.getaddressesbyaccount([[k] for k in accts],batch=True)
 		return list(zip(accts,alists))
 
 	def add_tw_data(self,wallet):

+ 6 - 6
mmgen/altcoins/eth/contract.py

@@ -66,7 +66,7 @@ class Token(MMGenObject): # ERC20
 		data = create_method_id(method_sig) + method_args
 		if g.debug:
 			msg('ETH_CALL {}:  {}'.format(method_sig,'\n  '.join(parse_abi(data))))
-		ret = g.rpch.eth_call({ 'to': '0x'+self.addr, 'data': '0x'+data })
+		ret = g.rpc.eth_call({ 'to': '0x'+self.addr, 'data': '0x'+data })
 		if toUnit:
 			return int(ret,16) * self.base_unit
 		else:
@@ -108,7 +108,7 @@ class Token(MMGenObject): # ERC20
 						'total supply:',   self.total_supply())
 
 	def code(self):
-		return g.rpch.eth_getCode('0x'+self.addr)[2:]
+		return g.rpc.eth_getCode('0x'+self.addr)[2:]
 
 	def create_data(self,to_addr,amt,method_sig='transfer(address,uint256)',from_addr=None):
 		from_arg = from_addr.rjust(64,'0') if from_addr else ''
@@ -131,8 +131,8 @@ class Token(MMGenObject): # ERC20
 		from .pyethereum.transactions import Transaction
 
 		if chain_id is None:
-			chain_id_method = ('parity_chainId','eth_chainId')['eth_chainId' in g.rpch.caps]
-			chain_id = int(g.rpch.request(chain_id_method),16)
+			chain_id_method = ('parity_chainId','eth_chainId')['eth_chainId' in g.rpc.caps]
+			chain_id = int(g.rpc.request(chain_id_method),16)
 		tx = Transaction(**tx_in).sign(key,chain_id)
 		hex_tx = rlp.encode(tx).hex()
 		coin_txid = CoinTxID(tx.hash.hex())
@@ -148,7 +148,7 @@ class Token(MMGenObject): # ERC20
 # The following are used for token deployment only:
 
 	def txsend(self,hex_tx):
-		return g.rpch.eth_sendRawTransaction('0x'+hex_tx).replace('0x','',1)
+		return g.rpc.eth_sendRawTransaction('0x'+hex_tx).replace('0x','',1)
 
 	def transfer(   self,from_addr,to_addr,amt,key,start_gas,gasPrice,
 					method_sig='transfer(address,uint256)',
@@ -157,7 +157,7 @@ class Token(MMGenObject): # ERC20
 		tx_in = self.make_tx_in(
 					from_addr,to_addr,amt,
 					start_gas,gasPrice,
-					nonce = int(g.rpch.parity_nextNonce('0x'+from_addr),16),
+					nonce = int(g.rpc.parity_nextNonce('0x'+from_addr),16),
 					method_sig = method_sig,
 					from_addr2 = from_addr2 )
 		(hex_tx,coin_txid) = self.txsign(tx_in,key,from_addr)

+ 1 - 1
mmgen/altcoins/eth/tw.py

@@ -88,7 +88,7 @@ class EthereumTrackingWallet(TrackingWallet):
 	def rpc_init(self): pass
 
 	def rpc_get_balance(self,addr):
-		return ETHAmt(int(g.rpch.eth_getBalance('0x'+addr),16),'wei')
+		return ETHAmt(int(g.rpc.eth_getBalance('0x'+addr),16),'wei')
 
 	@write_mode
 	def import_address(self,addr,label,foo):

+ 11 - 11
mmgen/altcoins/eth/tx.py

@@ -60,7 +60,7 @@ class EthereumMMGenTX(MMGenTX):
 
 	@classmethod
 	def get_exec_status(cls,txid,silent=False):
-		d = g.rpch.eth_getTransactionReceipt('0x'+txid)
+		d = g.rpc.eth_getTransactionReceipt('0x'+txid)
 		if not silent:
 			if 'contractAddress' in d and d['contractAddress']:
 				msg('Contract address: {}'.format(d['contractAddress'].replace('0x','')))
@@ -121,10 +121,10 @@ class EthereumMMGenTX(MMGenTX):
 		return d # 'token_addr','decimals' required by Token subclass
 
 	def get_nonce(self):
-		return ETHNonce(int(g.rpch.parity_nextNonce('0x'+self.inputs[0].addr),16))
+		return ETHNonce(int(g.rpc.parity_nextNonce('0x'+self.inputs[0].addr),16))
 
 	def make_txobj(self): # called by create_raw()
-		chain_id_method = ('parity_chainId','eth_chainId')['eth_chainId' in g.rpch.caps]
+		chain_id_method = ('parity_chainId','eth_chainId')['eth_chainId' in g.rpc.caps]
 		self.txobj = {
 			'from': self.inputs[0].addr,
 			'to':   self.outputs[0].addr if self.outputs else Str(''),
@@ -132,7 +132,7 @@ class EthereumMMGenTX(MMGenTX):
 			'gasPrice': self.usr_rel_fee or self.fee_abs2rel(self.fee,to_unit='eth'),
 			'startGas': self.start_gas,
 			'nonce': self.get_nonce(),
-			'chainId': Int(g.rpch.request(chain_id_method),16),
+			'chainId': Int(g.rpc.request(chain_id_method),16),
 			'data':  self.usr_contract_data,
 		}
 
@@ -157,7 +157,7 @@ class EthereumMMGenTX(MMGenTX):
 		self.txid = MMGenTxID(make_chksum_6(self.hex).upper())
 
 	def get_blockcount(self):
-		return Int(g.rpch.eth_blockNumber(),16)
+		return Int(g.rpc.eth_blockNumber(),16)
 
 	def process_cmd_args(self,cmd_args,ad_f,ad_w):
 		lc = len(cmd_args)
@@ -195,7 +195,7 @@ class EthereumMMGenTX(MMGenTX):
 
 	# get rel_fee (gas price) from network, return in native wei
 	def get_rel_fee_from_network(self):
-		return Int(g.rpch.eth_gasPrice(),16),'eth_gasPrice' # ==> rel_fee,fe_type
+		return Int(g.rpc.eth_gasPrice(),16),'eth_gasPrice' # ==> rel_fee,fe_type
 
 	# given rel fee and units, return absolute fee using tx_gas
 	def convert_fee_spec(self,foo,units,amt,unit):
@@ -327,14 +327,14 @@ class EthereumMMGenTX(MMGenTX):
 		class r(object): pass
 
 		def is_in_mempool():
-			if not 'full_node' in g.rpch.caps:
+			if not 'full_node' in g.rpc.caps:
 				return False
-			return '0x'+self.coin_txid in [x['hash'] for x in g.rpch.parity_pendingTransactions()]
+			return '0x'+self.coin_txid in [x['hash'] for x in g.rpc.parity_pendingTransactions()]
 
 		def is_in_wallet():
-			d = g.rpch.eth_getTransactionReceipt('0x'+self.coin_txid)
+			d = g.rpc.eth_getTransactionReceipt('0x'+self.coin_txid)
 			if d and 'blockNumber' in d and d['blockNumber'] is not None:
-				r.confs = 1 + int(g.rpch.eth_blockNumber(),16) - int(d['blockNumber'],16)
+				r.confs = 1 + int(g.rpc.eth_blockNumber(),16) - int(d['blockNumber'],16)
 				r.exec_status = int(d['status'],16)
 				return True
 			return False
@@ -372,7 +372,7 @@ class EthereumMMGenTX(MMGenTX):
 		if prompt_user:
 			self.confirm_send()
 
-		ret = None if g.bogus_send else g.rpch.eth_sendRawTransaction('0x'+self.hex,on_fail='return')
+		ret = None if g.bogus_send else g.rpc.eth_sendRawTransaction('0x'+self.hex,on_fail='return')
 
 		from mmgen.rpc import rpc_error,rpc_errmsg
 		if rpc_error(ret):

+ 1 - 1
mmgen/globalvars.py

@@ -107,7 +107,7 @@ class g(object):
 	monero_wallet_rpc_user = 'monero'
 	monero_wallet_rpc_password = ''
 	rpc_fail_on_command  = ''
-	rpch                 = None # global RPC handle
+	rpc                 = None # global RPC handle
 	use_cached_balances  = False
 
 	# regtest:

+ 1 - 1
mmgen/main_split.py

@@ -121,7 +121,7 @@ tx1 = MMGenSplitTX()
 opt.no_blank = True
 
 gmsg("Creating timelocked transaction for long chain ({})".format(g.coin))
-locktime = int(opt.locktime or 0) or g.rpch.getblockcount()
+locktime = int(opt.locktime or 0) or g.rpc.getblockcount()
 tx1.create(mmids[0],locktime)
 
 tx1.format()

+ 1 - 1
mmgen/rpc.py

@@ -435,7 +435,7 @@ def init_daemon_parity():
 		conn.caps += ('full_node',)
 
 	if g.token:
-		g.rpch = conn # set g.rpch so rpc_init() will return immediately
+		g.rpc = conn # set g.rpc so rpc_init() will return immediately
 		(g.token,g.dcoin) = resolve_token_arg(g.token)
 
 	return conn

+ 22 - 22
mmgen/tw.py

@@ -35,7 +35,7 @@ def get_tw_label(s):
 	except: return None
 
 _date_formatter = {
-	'days':      lambda secs: (g.rpch.cur_date - secs) // 86400,
+	'days':      lambda secs: (g.rpc.cur_date - secs) // 86400,
 	'date':      lambda secs: '{}-{:02}-{:02}'.format(*time.gmtime(secs)[:3])[2:],
 	'date_time': lambda secs: '{}-{:02}-{:02} {:02}:{:02}'.format(*time.gmtime(secs)[:5]),
 }
@@ -43,7 +43,7 @@ _date_formatter = {
 def _set_dates(us):
 	if us and us[0].date is None:
 		# 'blocktime' differs from 'time', is same as getblockheader['time']
-		dates = [o['blocktime'] for o in g.rpch.calls('gettransaction',[(o.txid,) for o in us])]
+		dates = [o['blocktime'] for o in g.rpc.calls('gettransaction',[(o.txid,) for o in us])]
 		for o,date in zip(us,dates):
 			o.date = date
 
@@ -149,7 +149,7 @@ watch-only wallet using '{}-addrimport' and then re-run this program.
 
 		# for now, self.addrs is just an empty list for Bitcoin and friends
 		add_args = (9999999,self.addrs) if self.addrs else ()
-		return g.rpch.listunspent(self.minconf,*add_args)
+		return g.rpc.listunspent(self.minconf,*add_args)
 
 	def get_unspent_data(self):
 		if g.bogus_wallet_data: # for debugging purposes only
@@ -159,7 +159,7 @@ watch-only wallet using '{}-addrimport' and then re-run this program.
 
 		if not us_rpc: die(0,self.wmsg['no_spendable_outputs'])
 		tr_rpc = []
-		lbl_id = ('account','label')['label_api' in g.rpch.caps]
+		lbl_id = ('account','label')['label_api' in g.rpc.caps]
 		for o in us_rpc:
 			if not lbl_id in o:
 				continue # coinbase outputs have no account field
@@ -325,7 +325,7 @@ watch-only wallet using '{}-addrimport' and then re-run this program.
 						A=i.amt.fmt(color=color),
 						A2=(i.amt2.fmt(color=color) if i.amt2 is not None else ''),
 						c=i.confs,
-						b=g.rpch.blockcount - (i.confs - 1),
+						b=g.rpc.blockcount - (i.confs - 1),
 						D=self.age_disp(i,'date_time'),
 						l=i.label.hl(color=color) if i.label else
 							TwComment.fmtc('',color=color,nullrepl='-',width=max_lbl_len)).rstrip())
@@ -333,8 +333,8 @@ watch-only wallet using '{}-addrimport' and then re-run this program.
 		fs = '{} (block #{}, {} UTC)\nSort order: {}\n{}\n\nTotal {}: {}\n'
 		self.fmt_print = fs.format(
 				capfirst(self.desc),
-				g.rpch.blockcount,
-				make_timestr(g.rpch.cur_date),
+				g.rpc.blockcount,
+				make_timestr(g.rpc.cur_date),
 				' '.join(self.sort_info(include_group=False)),
 				'\n'.join(out),
 				g.dcoin,
@@ -454,7 +454,7 @@ watch-only wallet using '{}-addrimport' and then re-run this program.
 		if age_fmt == 'confs':
 			return o.confs
 		elif age_fmt == 'block':
-			return g.rpch.blockcount - (o.confs - 1)
+			return g.rpc.blockcount - (o.confs - 1)
 		else:
 			return _date_formatter[age_fmt](o.date)
 
@@ -492,8 +492,8 @@ class TwAddrList(MMGenDict):
 		self.total = g.proto.coin_amt('0')
 		rpc_init()
 
-		lbl_id = ('account','label')['label_api' in g.rpch.caps]
-		for d in g.rpch.listunspent(0):
+		lbl_id = ('account','label')['label_api' in g.rpc.caps]
+		for d in g.rpc.listunspent(0):
 			if not lbl_id in d: continue  # skip coinbase outputs with missing account
 			if d['confirmations'] < minconf: continue
 			label = get_tw_label(d[lbl_id])
@@ -519,12 +519,12 @@ class TwAddrList(MMGenDict):
 		if showempty or all_labels:
 			# for compatibility with old mmids, must use raw RPC rather than native data for matching
 			# args: minconf,watchonly, MUST use keys() so we get list, not dict
-			if 'label_api' in g.rpch.caps:
-				acct_list = g.rpch.listlabels()
-				acct_addrs = [list(a.keys()) for a in g.rpch.getaddressesbylabel([[k] for k in acct_list],batch=True)]
+			if 'label_api' in g.rpc.caps:
+				acct_list = g.rpc.listlabels()
+				acct_addrs = [list(a.keys()) for a in g.rpc.getaddressesbylabel([[k] for k in acct_list],batch=True)]
 			else:
-				acct_list = list(g.rpch.listaccounts(0,True).keys()) # raw list, no 'L'
-				acct_addrs = g.rpch.getaddressesbyaccount([[a] for a in acct_list],batch=True) # use raw list here
+				acct_list = list(g.rpc.listaccounts(0,True).keys()) # raw list, no 'L'
+				acct_addrs = g.rpc.getaddressesbyaccount([[a] for a in acct_list],batch=True) # use raw list here
 			acct_labels = MMGenList([get_tw_label(a) for a in acct_list])
 			check_dup_mmid(acct_labels)
 			assert len(acct_list) == len(acct_addrs),(
@@ -753,11 +753,11 @@ class TrackingWallet(MMGenObject):
 
 	@write_mode
 	def import_address(self,addr,label,rescan):
-		return g.rpch.importaddress(addr,label,rescan,timeout=(False,3600)[rescan])
+		return g.rpc.importaddress(addr,label,rescan,timeout=(False,3600)[rescan])
 
 	@write_mode
 	def batch_import_address(self,arg_list):
-		return g.rpch.importaddress(arg_list,batch=True)
+		return g.rpc.importaddress(arg_list,batch=True)
 
 	def force_write(self):
 		mode_save = self.mode
@@ -796,13 +796,13 @@ class TrackingWallet(MMGenObject):
 	def set_label(self,coinaddr,lbl):
 		# bitcoin-abc 'setlabel' RPC is broken, so use old 'importaddress' method to set label
 		# broken behavior: new label is set OK, but old label gets attached to another address
-		if 'label_api' in g.rpch.caps and g.coin != 'BCH':
-			return g.rpch.setlabel(coinaddr,lbl,on_fail='return')
+		if 'label_api' in g.rpc.caps and g.coin != 'BCH':
+			return g.rpc.setlabel(coinaddr,lbl,on_fail='return')
 		else:
 			# NOTE: this works because importaddress() removes the old account before
 			# associating the new account with the address.
 			# RPC args: addr,label,rescan[=true],p2sh[=none]
-			return g.rpch.importaddress(coinaddr,lbl,False,on_fail='return')
+			return g.rpc.importaddress(coinaddr,lbl,False,on_fail='return')
 
 	# returns on failure
 	@write_mode
@@ -885,8 +885,8 @@ class TwGetBalance(MMGenObject):
 
 	def create_data(self):
 		# 0: unconfirmed, 1: below minconf, 2: confirmed, 3: spendable (privkey in wallet)
-		lbl_id = ('account','label')['label_api' in g.rpch.caps]
-		for d in g.rpch.listunspent(0):
+		lbl_id = ('account','label')['label_api' in g.rpc.caps]
+		for d in g.rpc.listunspent(0):
 			lbl = get_tw_label(d[lbl_id])
 			if lbl:
 				if lbl.mmid.type == 'mmgen':

+ 18 - 18
mmgen/tx.py

@@ -83,7 +83,7 @@ def mmaddr2coinaddr(mmaddr,ad_w,ad_f):
 
 def segwit_is_active(exit_on_error=False):
 	rpc_init()
-	d = g.rpch.getblockchaininfo()
+	d = g.rpc.getblockchaininfo()
 	if d['chain'] == 'regtest':
 		return True
 	if (    'bip9_softforks' in d
@@ -405,7 +405,7 @@ Selected non-{pnm} inputs: {{}}""".strip().format(pnm=g.proj_name,pnl=g.proj_nam
 		if self.inputs[0].sequence:
 			i[0]['sequence'] = self.inputs[0].sequence
 		o = {e.addr:e.amt for e in self.outputs}
-		self.hex = HexStr(g.rpch.createrawtransaction(i,o))
+		self.hex = HexStr(g.rpc.createrawtransaction(i,o))
 		self.update_txid()
 
 	def print_contract_addr(self): pass
@@ -438,7 +438,7 @@ Selected non-{pnm} inputs: {{}}""".strip().format(pnm=g.proj_name,pnl=g.proj_nam
 
 	def compare_size_and_estimated_size(self):
 		est_vsize = self.estimate_size()
-		d = g.rpch.decoderawtransaction(self.hex)
+		d = g.rpc.decoderawtransaction(self.hex)
 		vsize = d['vsize'] if 'vsize' in d else d['size']
 		vmsg('\nVsize: {} (true) {} (estimated)'.format(vsize,est_vsize))
 		m1 = 'Estimated transaction vsize is {:1.2f} times the true vsize\n'
@@ -523,7 +523,7 @@ Selected non-{pnm} inputs: {{}}""".strip().format(pnm=g.proj_name,pnl=g.proj_nam
 
 	# coin-specific fee routines
 	def get_relay_fee(self):
-		kb_fee = g.proto.coin_amt(g.rpch.getnetworkinfo()['relayfee'])
+		kb_fee = g.proto.coin_amt(g.rpc.getnetworkinfo()['relayfee'])
 		ret = kb_fee * self.estimate_size() // 1024
 		vmsg('Relay fee: {} {c}/kB, for transaction: {} {c}'.format(kb_fee,ret,c=g.coin))
 		return ret
@@ -535,7 +535,7 @@ Selected non-{pnm} inputs: {{}}""".strip().format(pnm=g.proj_name,pnl=g.proj_nam
 
 	def get_rel_fee_from_network(self):
 		try:
-			ret = g.rpch.estimatesmartfee(opt.tx_confs,opt.fee_estimate_mode.upper())
+			ret = g.rpc.estimatesmartfee(opt.tx_confs,opt.fee_estimate_mode.upper())
 			fee_per_kb = ret['feerate'] if 'feerate' in ret else -2
 			fe_type = 'estimatesmartfee'
 		except:
@@ -678,7 +678,7 @@ Selected non-{pnm} inputs: {{}}""".strip().format(pnm=g.proj_name,pnl=g.proj_nam
 		self.hex = self.hex[:-8] + bytes.fromhex('{:08x}'.format(val))[::-1].hex()
 
 	def get_blockcount(self):
-		return int(g.rpch.getblockcount())
+		return int(g.rpc.getblockcount())
 
 	def add_blockcount(self):
 		self.blockcount = self.get_blockcount()
@@ -754,9 +754,9 @@ Selected non-{pnm} inputs: {{}}""".strip().format(pnm=g.proj_name,pnl=g.proj_nam
 		wifs = [d.sec.wif for d in keys]
 
 		try:
-			ret = g.rpch.signrawtransactionwithkey(self.hex,wifs,sig_data,g.proto.sighash_type) \
-				if 'sign_with_key' in g.rpch.caps else \
-					g.rpch.signrawtransaction(self.hex,sig_data,wifs,g.proto.sighash_type)
+			ret = g.rpc.signrawtransactionwithkey(self.hex,wifs,sig_data,g.proto.sighash_type) \
+				if 'sign_with_key' in g.rpc.caps else \
+					g.rpc.signrawtransaction(self.hex,sig_data,wifs,g.proto.sighash_type)
 		except Exception as e:
 			msg(yellow('This is not the BCH chain.\nRe-run the script without the --coin=bch option.'
 				if 'Invalid sighash param' in e.args[0] else e.args[0]))
@@ -774,7 +774,7 @@ Selected non-{pnm} inputs: {{}}""".strip().format(pnm=g.proj_name,pnl=g.proj_nam
 			self.check_hex_tx_matches_mmgen_tx(dt)
 			self.coin_txid = CoinTxID(dt['txid'],on_fail='raise')
 			self.check_sigs(dt)
-			if not self.coin_txid == g.rpch.decoderawtransaction(ret['hex'])['txid']:
+			if not self.coin_txid == g.rpc.decoderawtransaction(ret['hex'])['txid']:
 				raise BadMMGenTxID('txid mismatch (after signing)')
 			msg('OK')
 			return True
@@ -879,7 +879,7 @@ Selected non-{pnm} inputs: {{}}""".strip().format(pnm=g.proj_name,pnl=g.proj_nam
 		class r(object): pass
 
 		def is_in_wallet():
-			ret = g.rpch.gettransaction(self.coin_txid,on_fail='silent')
+			ret = g.rpc.gettransaction(self.coin_txid,on_fail='silent')
 			if 'confirmations' in ret and ret['confirmations'] > 0:
 				r.confs = ret['confirmations']
 				return True
@@ -887,14 +887,14 @@ Selected non-{pnm} inputs: {{}}""".strip().format(pnm=g.proj_name,pnl=g.proj_nam
 				return False
 
 		def is_in_utxos():
-			return 'txid' in g.rpch.getrawtransaction(self.coin_txid,True,on_fail='silent')
+			return 'txid' in g.rpc.getrawtransaction(self.coin_txid,True,on_fail='silent')
 
 		def is_in_mempool():
-			return 'height' in g.rpch.getmempoolentry(self.coin_txid,on_fail='silent')
+			return 'height' in g.rpc.getmempoolentry(self.coin_txid,on_fail='silent')
 
 		def is_replaced():
 			if is_in_mempool(): return False
-			ret = g.rpch.gettransaction(self.coin_txid,on_fail='silent')
+			ret = g.rpc.gettransaction(self.coin_txid,on_fail='silent')
 
 			if not 'bip125-replaceable' in ret or not 'confirmations' in ret or ret['confirmations'] > 0:
 				return False
@@ -905,7 +905,7 @@ Selected non-{pnm} inputs: {{}}""".strip().format(pnm=g.proj_name,pnl=g.proj_nam
 
 		if is_in_mempool():
 			if status:
-				d = g.rpch.gettransaction(self.coin_txid,on_fail='silent')
+				d = g.rpc.gettransaction(self.coin_txid,on_fail='silent')
 				brs = 'bip125-replaceable'
 				rep = '{}replaceable'.format(('NOT ','')[brs in d and d[brs]=='yes'])
 				t = d['timereceived']
@@ -930,7 +930,7 @@ Selected non-{pnm} inputs: {{}}""".strip().format(pnm=g.proj_name,pnl=g.proj_nam
 			msg('{}\n{}'.format(m1,m2))
 			if not opt.quiet:
 				msg('Replacing transactions:')
-				d = ((t,g.rpch.getmempoolentry(t,on_fail='silent')) for t in r.replacing_txs)
+				d = ((t,g.rpc.getmempoolentry(t,on_fail='silent')) for t in r.replacing_txs)
 				for txid,mp_entry in d:
 					msg('  {}{}'.format(txid,' in mempool' if ('height' in mp_entry) else ''))
 			die(0,'')
@@ -965,7 +965,7 @@ Selected non-{pnm} inputs: {{}}""".strip().format(pnm=g.proj_name,pnl=g.proj_nam
 
 		if prompt_user: self.confirm_send()
 
-		ret = None if g.bogus_send else g.rpch.sendrawtransaction(self.hex,on_fail='return')
+		ret = None if g.bogus_send else g.rpc.sendrawtransaction(self.hex,on_fail='return')
 
 		from .rpc import rpc_error,rpc_errmsg
 		if rpc_error(ret):
@@ -1061,7 +1061,7 @@ Selected non-{pnm} inputs: {{}}""".strip().format(pnm=g.proj_name,pnl=g.proj_nam
 				msg('')
 
 #	def is_replaceable_from_rpc(self):
-#		dec_tx = g.rpch.decoderawtransaction(self.hex)
+#		dec_tx = g.rpc.decoderawtransaction(self.hex)
 #		return None < dec_tx['vin'][0]['sequence'] <= g.max_int - 2
 
 	def is_replaceable(self):

+ 3 - 3
mmgen/util.py

@@ -843,10 +843,10 @@ def get_coin_daemon_auth_cookie():
 def rpc_init(reinit=False):
 	if not 'rpc' in g.proto.mmcaps:
 		die(1,'Coin daemon operations not supported for coin {}!'.format(g.coin))
-	if g.rpch != None and not reinit: return g.rpch
+	if g.rpc != None and not reinit: return g.rpc
 	from .rpc import init_daemon
-	g.rpch = init_daemon(g.proto.daemon_family)
-	return g.rpch
+	g.rpc = init_daemon(g.proto.daemon_family)
+	return g.rpc
 
 def format_par(s,indent=0,width=80,as_list=False):
 	words,lines = s.split(),[]

+ 1 - 1
test/test_py_d/ts_main.py

@@ -147,7 +147,7 @@ class TestSuiteMain(TestSuiteBase,TestSuiteShared):
 		if g.coin.lower() not in self.networks:
 			return
 		rpc_init()
-		self.lbl_id = ('account','label')['label_api' in g.rpch.caps]
+		self.lbl_id = ('account','label')['label_api' in g.rpc.caps]
 		if g.coin in ('BTC','BCH','LTC'):
 			self.tx_fee     = {'btc':'0.0001','bch':'0.001','ltc':'0.01'}[g.coin.lower()]
 			self.txbump_fee = {'btc':'123s','bch':'567s','ltc':'12345s'}[g.coin.lower()]

+ 1 - 1
test/unit_tests_d/ut_tx_deserialize.py

@@ -25,7 +25,7 @@ class unit_test(object):
 						return True
 				return False
 
-			d = g.rpch.decoderawtransaction(txhex)
+			d = g.rpc.decoderawtransaction(txhex)
 
 			if has_nonstandard_outputs(d['vout']): return False