minor fixes

This commit is contained in:
The MMGen Project 2022-04-23 14:36:08 +00:00
commit 830d07cde2
Signed by: mmgen
GPG key ID: 3F8B1861E32B7DA2
6 changed files with 6 additions and 5 deletions

View file

@ -22,7 +22,6 @@ class New(Base,TxBase.New):
usr_fee_prompt = 'Enter transaction fee: '
fee_fail_fs = 'Network fee estimation for {c} confirmations failed ({t})'
no_chg_msg = 'Warning: Change address will be deleted as transaction produces no change'
msg_wallet_low_coin = 'Wallet has insufficient funds for this transaction ({} {} needed)'
@property
def relay_fee(self):

View file

@ -59,8 +59,7 @@ class mainnet(CoinProtocol.DummyWIF,CoinProtocol.Secp256k1):
Msg(f'Invalid address: {addr}')
return False
@classmethod
def checksummed_addr(cls,addr):
def checksummed_addr(self,addr):
h = self.keccak_256(addr.encode()).digest().hex()
return ''.join(addr[i].upper() if int(h[i],16) > 7 else addr[i] for i in range(len(addr)))

View file

@ -63,6 +63,7 @@ class New(Base):
fee_is_approximate = False
msg_low_coin = 'Selected outputs insufficient to fund this transaction ({} {} needed)'
msg_wallet_low_coin = 'Wallet has insufficient funds for this transaction ({} {} needed)'
msg_no_change_output = """
ERROR: No change address specified. If you wish to create a transaction with
only one output, specify a single output address with no {} amount

View file

@ -181,7 +181,7 @@ def create_src(proto,template,token_data,owner_addr):
for k in token_data.fields:
field = getattr(token_data,k)
if k == 'owner_addr':
from mmgen.obj import is_coin_addr
from mmgen.addr import is_coin_addr
if not is_coin_addr( proto, owner_addr.lower() ):
die(1,f'{owner_addr}: not a valid {proto.coin} coin address')
val = '0x' + owner_addr

View file

@ -744,7 +744,7 @@ class TestSuiteEthdev(TestSuiteBase,TestSuiteShared):
'scripts/create-token.py',
'--coin=' + self.proto.coin,
'--outdir=' + odir
] + cmd_args + [CoinProtocol.Ethereum.checksummed_addr(dfl_devaddr)]
] + cmd_args + [self.proto.checksummed_addr(dfl_devaddr)]
imsg('Executing: {}'.format( ' '.join(cmd) ))
cp = run(cmd,stdout=DEVNULL,stderr=PIPE)
if cp.returncode != 0:

View file

@ -55,6 +55,8 @@ opts.UserOpts._reset_ok += ('use_internal_keccak_module',)
cmd_args = opts.init(opts_data)
os.environ['PYTHONPATH'] = repo_root
file_pfx = 'nt_' if opt.node_tools else 'ut_'
all_tests = sorted(