gentest.py: add moneropy as external checking library

This commit is contained in:
The MMGen Project 2019-11-01 12:34:51 +00:00
commit 9518f702a9
Signed by: mmgen
GPG key ID: 3F8B1861E32B7DA2
3 changed files with 18 additions and 1 deletions

View file

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

View file

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

View file

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