Browse Source

whitespace; minor fix

The MMGen Project 1 year ago
parent
commit
e8f48bd66e
4 changed files with 35 additions and 16 deletions
  1. 14 9
      mmgen/proto/btc/tw/addresses.py
  2. 2 1
      mmgen/rpc.py
  3. 4 4
      mmgen/tool/rpc.py
  4. 15 2
      mmgen/tw/json.py

+ 14 - 9
mmgen/proto/btc/tw/addresses.py

@@ -54,15 +54,20 @@ Actions: [q]uit menu, r[e]draw, add [l]abel:
 		self.total = sum((v['amt'] for v in addrs.values())) or amt0 # Python 3.8: start=amt0
 
 		msg_r('Getting labels and associated addresses...')
-		for label,addr in await self.get_addr_label_pairs():
-			if label and label.mmid not in addrs:
-				addrs[label.mmid] = {
-					'addr':   addr,
-					'amt':    amt0,
-					'recvd':  amt0,
-					'confs':  0,
-					'lbl':    label }
-		msg('done')
+		pairs = await self.get_addr_label_pairs()
+
+		if pairs:
+			for label,addr in pairs:
+				if label and label.mmid not in addrs:
+					addrs[label.mmid] = {
+						'addr':   addr,
+						'amt':    amt0,
+						'recvd':  amt0,
+						'confs':  0,
+						'lbl':    label }
+			msg('done')
+		else:
+			msg('[none]')
 
 		msg_r('Getting received funds data...')
 		# args: 1:minconf, 2:include_empty, 3:include_watchonly, 4:include_immature_coinbase (>=v23.0.0)

+ 2 - 1
mmgen/rpc.py

@@ -308,7 +308,8 @@ class RPCClient(MMGenObject):
 		self.backend = (await ret) if type(ret).__name__ == 'coroutine' else ret
 
 	# Call family of methods - direct-to-daemon RPC call:
-	# positional params are passed to the daemon, 'timeout' and 'wallet' kwargs to the backend
+	# - positional params are passed to the daemon, 'timeout' and 'wallet' kwargs to the backend
+	# - 'wallet' kwarg is used only by regtest
 
 	async def call(self,method,*params,timeout=None,wallet=None):
 		"""

+ 4 - 4
mmgen/tool/rpc.py

@@ -229,10 +229,10 @@ class tool_cmd(tool_cmd_base):
 		await TwJSON.Export(
 			self.cfg,
 			self.proto,
-			include_amts = include_amts,
-			pretty       = pretty,
-			prune        = prune,
-			warn_used    = warn_used )
+			include_amts    = include_amts,
+			pretty          = pretty,
+			prune           = prune,
+			warn_used       = warn_used )
 		return True
 
 	async def twimport(self,filename:str,ignore_checksum=False,batch=False):

+ 15 - 2
mmgen/tw/json.py

@@ -86,7 +86,13 @@ class TwJSON:
 
 		blockchain_rescan_warning = None
 
-		async def __init__(self,cfg,proto,filename,ignore_checksum=False,batch=False):
+		async def __init__(
+				self,
+				cfg,
+				proto,
+				filename,
+				ignore_checksum = False,
+				batch           = False ):
 
 			super().__init__(cfg,proto)
 
@@ -154,7 +160,14 @@ class TwJSON:
 
 	class Export(Base,metaclass=AsyncInit):
 
-		async def __init__(self,cfg,proto,include_amts=True,pretty=False,prune=False,warn_used=False):
+		async def __init__(
+				self,
+				cfg,
+				proto,
+				include_amts    = True,
+				pretty          = False,
+				prune           = False,
+				warn_used       = False ):
 
 			if prune and not self.can_prune:
 				die(1,f'Pruning not supported for {proto.name} protocol')