From 9518f702a9d875a52e091b373a2303519ec39e49 Mon Sep 17 00:00:00 2001 From: The MMGen Project Date: Fri, 1 Nov 2019 12:34:51 +0000 Subject: [PATCH] gentest.py: add moneropy as external checking library --- mmgen/altcoin.py | 1 + test/gentest.py | 17 ++++++++++++++++- test/test-release.sh | 1 + 3 files changed, 18 insertions(+), 1 deletion(-) diff --git a/mmgen/altcoin.py b/mmgen/altcoin.py index f61f6c45..19fa4a91 100755 --- a/mmgen/altcoin.py +++ b/mmgen/altcoin.py @@ -497,6 +497,7 @@ class CoinInfo(object): trust_override = {'BTC':3,'BCH':3,'LTC':3,'DASH':1,'EMC':2} external_tests = { 'mainnet': { + 'moneropy': ('XMR',), 'pycoin': ( # broken: DASH - only compressed, LTC segwit old fmt 'BTC','LTC','VIA','FTC','DOGE','MEC', diff --git a/test/gentest.py b/test/gentest.py index c805d848..e9ab5ea8 100755 --- a/test/gentest.py +++ b/test/gentest.py @@ -66,6 +66,7 @@ EXAMPLES: External libraries required for the 'ext' generator: + ethkey (for ETH,ETC) https://github.com/paritytech/parity-ethereum + zcash-mini (for zcash_z addresses) https://github.com/FiloSottile/zcash-mini + + moneropy (for Monero addresses) https://github.com/bigreddmachine/MoneroPy + pycoin (for supported coins) https://github.com/richardkiss/pycoin + keyconv (for all other coins) https://github.com/exploitagency/vanitygen-plus ('keyconv' generates uncompressed addresses only) @@ -121,6 +122,10 @@ def pycoin_sec2addr(sec): addr = key.address() return (key.wif(),addr) +def moneropy_sec2addr(sec): + sk_t,vk_t,addr_t = mp_acc.account_from_spend_key(sec) # VERY slow! + return (sk_t,addr_t,vk_t) + # pycoin/networks/all.py pycoin/networks/legacy_networks.py def init_external_prog(): global b,b_desc,ext_prog,ext_sec2addr,eth,addr_type @@ -148,6 +153,16 @@ def init_external_prog(): raise ImportError("Unable to import pycoin.networks.registry Is pycoin installed and up-to-date?") ext_sec2addr = pycoin_sec2addr ext_prog = 'pycoin' + elif test_support('moneropy'): + global mp_acc + try: + import moneropy.account as mp_acc + except: + raise ImportError("Unable to import moneropy. Is moneropy installed on your system?") + ext_sec2addr = moneropy_sec2addr + init_coin('xmr') + ext_prog = 'moneropy' + addr_type = MMGenAddrType('M') elif test_support('keyconv'): ext_sec2addr = keyconv_sec2addr ext_prog = 'keyconv' @@ -291,7 +306,7 @@ else: try: a = int(a) assert 1 <= a <= len(g.key_generators),'{}: invalid key generator'.format(a) - if b in ('ext','ethkey','pycoin','keyconv','zcash_mini'): + if b in ('ext','ethkey','pycoin','keyconv','zcash_mini','moneropy'): init_external_prog() else: b = int(b) diff --git a/test/test-release.sh b/test/test-release.sh index 9ff261e5..419ce62f 100755 --- a/test/test-release.sh +++ b/test/test-release.sh @@ -278,6 +278,7 @@ t_alts=" $gentest_py --coin=zec 2:ext $rounds $gentest_py --coin=zec --type=zcash_z 2:ext $rounds_mid $gentest_py --all 2:zcash_mini $rounds_mid + $gentest_py --all 2:moneropy $rounds_min " }