From 830d07cde215d052bca037af8a0a661fb9c18e72 Mon Sep 17 00:00:00 2001 From: The MMGen Project Date: Sat, 23 Apr 2022 14:36:08 +0000 Subject: [PATCH] minor fixes --- mmgen/base_proto/bitcoin/tx/new.py | 1 - mmgen/proto/eth.py | 3 +-- mmgen/tx/new.py | 1 + scripts/create-token.py | 2 +- test/test_py_d/ts_ethdev.py | 2 +- test/unit_tests.py | 2 ++ 6 files changed, 6 insertions(+), 5 deletions(-) diff --git a/mmgen/base_proto/bitcoin/tx/new.py b/mmgen/base_proto/bitcoin/tx/new.py index 225ab595..d2a2df52 100755 --- a/mmgen/base_proto/bitcoin/tx/new.py +++ b/mmgen/base_proto/bitcoin/tx/new.py @@ -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): diff --git a/mmgen/proto/eth.py b/mmgen/proto/eth.py index 670434ff..17e3ef61 100755 --- a/mmgen/proto/eth.py +++ b/mmgen/proto/eth.py @@ -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))) diff --git a/mmgen/tx/new.py b/mmgen/tx/new.py index e2840c87..22d64113 100755 --- a/mmgen/tx/new.py +++ b/mmgen/tx/new.py @@ -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 diff --git a/scripts/create-token.py b/scripts/create-token.py index 1ebc77cc..df3f5385 100755 --- a/scripts/create-token.py +++ b/scripts/create-token.py @@ -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 diff --git a/test/test_py_d/ts_ethdev.py b/test/test_py_d/ts_ethdev.py index 9fd970be..76849973 100755 --- a/test/test_py_d/ts_ethdev.py +++ b/test/test_py_d/ts_ethdev.py @@ -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: diff --git a/test/unit_tests.py b/test/unit_tests.py index bdae82b4..0d92deb7 100755 --- a/test/unit_tests.py +++ b/test/unit_tests.py @@ -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(