Browse Source

minor fixes, cleanups, whitespace

The MMGen Project 1 week ago
parent
commit
9652e3e3da

+ 1 - 2
mmgen/proto/eth/contract.py

@@ -125,7 +125,6 @@ class Token(Contract):
 			return int(ret, 16)
 		except:
 			msg(f'RPC call to decimals() failed (returned {ret!r})')
-			return None
 
 	async def get_total_supply(self):
 		return await self.do_call('totalSupply()', toUnit=True)
@@ -170,7 +169,7 @@ class Token(Contract):
 			'nonce':    nonce,
 			'data':     bytes.fromhex(data)}
 
-	# used for token deployment only:
+	# used for testing only:
 	async def transfer(
 			self,
 			*,

+ 1 - 1
mmgen/proto/eth/tw/addresses.py

@@ -75,7 +75,7 @@ class EthereumTwAddresses(TwAddresses, EthereumTwView, EthereumTwRPC):
 				'addr':  e.coinaddr,
 				'amt':   bal,
 				'recvd': bal, # since it’s nearly impossible to empty an Ethereum account,
-							  # we consider a used account to be any account with a balance
+				              # we consider a used account to be any account with a balance
 				'confs': 0,
 				'lbl':   e.label}
 			self.total += bal

+ 1 - 0
mmgen/proto/eth/tx/base.py

@@ -54,6 +54,7 @@ class Base(TxBase):
 	def is_replaceable(self):
 		return True
 
+	# used for testing only:
 	async def get_receipt(self, txid):
 		rx = await self.rpc.call('eth_getTransactionReceipt', '0x'+txid) # -> null if pending
 		if not rx:

+ 1 - 0
test/cmdtest_d/ct_automount_eth.py

@@ -121,6 +121,7 @@ class CmdTestAutosignETH(CmdTestAutosignThreaded, CmdTestEthdev):
 		return self.token_bal(pat=r':E:11\s+998.76544\s+54.318\d+\s+.*:E:12\s+1\.23456\s+')
 
 	def token_bal(self, pat):
+		self.mining_delay()
 		t = self.spawn('mmgen-tool', ['--regtest=1', '--token=mm1', 'twview', 'wide=1'])
 		text = t.read(strip_color=True)
 		assert re.search(pat, text, re.DOTALL), f'output failed to match regex {pat}'

+ 1 - 1
test/cmdtest_d/ct_ethdev.py

@@ -472,7 +472,7 @@ class CmdTestEthdev(CmdTestBase, CmdTestShared):
 
 	def mining_delay(self): # workaround for mining race condition in dev mode
 		if self.daemon.id == 'reth':
-			time.sleep(0.5)
+			time.sleep(1)
 
 	async def setup(self):
 		self.spawn(msg_only=True)

+ 1 - 0
test/cmdtest_d/ct_ethswap.py

@@ -210,6 +210,7 @@ class CmdTestEthSwapEth(CmdTestEthdev, CmdTestSwapMethods):
 		return self._swaptxsend()
 
 	def swaptxstatus1(self):
+		self.mining_delay()
 		return self._swaptxsend(add_opts=['--verbose', '--status'], status=True)
 
 	def bal1(self):