minor fixes, cleanups, whitespace

This commit is contained in:
The MMGen Project 2025-03-25 09:46:01 +00:00
commit 9652e3e3da
Signed by: mmgen
GPG key ID: 3F8B1861E32B7DA2
6 changed files with 6 additions and 4 deletions

View file

@ -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,
*,

View file

@ -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

View file

@ -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:

View file

@ -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}'

View file

@ -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)

View file

@ -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):