global rename: Daemon -> CoinDaemon
This commit is contained in:
parent
6f0e51d566
commit
93bb5ebcb5
9 changed files with 28 additions and 28 deletions
|
|
@ -26,7 +26,7 @@ from collections import namedtuple
|
|||
from mmgen.exception import *
|
||||
from mmgen.common import *
|
||||
|
||||
class Daemon(MMGenObject):
|
||||
class CoinDaemon(MMGenObject):
|
||||
cfg_file_hdr = ''
|
||||
|
||||
subclasses_must_implement = ('state','stop_cmd')
|
||||
|
|
@ -249,7 +249,7 @@ class Daemon(MMGenObject):
|
|||
for k in cls.subclasses_must_implement:
|
||||
assert k in subcls.__dict__, m.format(k,subcls.__name__)
|
||||
|
||||
class BitcoinDaemon(Daemon):
|
||||
class BitcoinDaemon(CoinDaemon):
|
||||
cfg_file_hdr = '# BitcoinDaemon config file\n'
|
||||
|
||||
def subclass_init(self):
|
||||
|
|
@ -298,7 +298,7 @@ class BitcoinDaemon(Daemon):
|
|||
def stop_cmd(self):
|
||||
return self.cli_cmd('stop')
|
||||
|
||||
class MoneroDaemon(Daemon):
|
||||
class MoneroDaemon(CoinDaemon):
|
||||
|
||||
@property
|
||||
def shared_args(self):
|
||||
|
|
@ -326,7 +326,7 @@ class MoneroDaemon(Daemon):
|
|||
def stop_cmd(self):
|
||||
return [self.coind_exec] + self.shared_args + ['exit']
|
||||
|
||||
class EthereumDaemon(Daemon):
|
||||
class EthereumDaemon(CoinDaemon):
|
||||
|
||||
def subclass_init(self):
|
||||
# defaults:
|
||||
|
|
@ -372,4 +372,4 @@ class EthereumDaemon(Daemon):
|
|||
else:
|
||||
return super().pid
|
||||
|
||||
Daemon.check_implement()
|
||||
CoinDaemon.check_implement()
|
||||
|
|
|
|||
|
|
@ -114,7 +114,7 @@ import mmgen.altcoins.eth.tx
|
|||
from mmgen.txsign import txsign
|
||||
from mmgen.protocol import CoinProtocol,init_coin
|
||||
if g.test_suite:
|
||||
from mmgen.daemon import Daemon
|
||||
from mmgen.daemon import CoinDaemon
|
||||
|
||||
if opt.stealth_led: opt.led = True
|
||||
|
||||
|
|
@ -136,7 +136,7 @@ def check_daemons_running():
|
|||
continue
|
||||
if g.test_suite:
|
||||
g.proto.daemon_data_dir = 'test/daemons/' + coin.lower()
|
||||
g.rpc_port = Daemon(get_network_id(coin,g.testnet),test_suite=True).rpc_port
|
||||
g.rpc_port = CoinDaemon(get_network_id(coin,g.testnet),test_suite=True).rpc_port
|
||||
vmsg('Checking {} daemon'.format(coin))
|
||||
try:
|
||||
rpc_init(reinit=True)
|
||||
|
|
@ -199,7 +199,7 @@ def sign_tx_file(txfile,signed_txs):
|
|||
if g.proto.sign_mode == 'daemon':
|
||||
if g.test_suite:
|
||||
g.proto.daemon_data_dir = 'test/daemons/' + g.coin.lower()
|
||||
g.rpc_port = Daemon(get_network_id(g.coin,g.testnet),test_suite=True).rpc_port
|
||||
g.rpc_port = CoinDaemon(get_network_id(g.coin,g.testnet),test_suite=True).rpc_port
|
||||
rpc_init(reinit=True)
|
||||
|
||||
if txsign(tx,wfs,None,None):
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@ regtest: Coin daemon regression test mode setup and operations for the MMGen sui
|
|||
import os,time,shutil,re,json
|
||||
from subprocess import run,PIPE
|
||||
from mmgen.common import *
|
||||
from mmgen.daemon import Daemon
|
||||
from mmgen.daemon import CoinDaemon
|
||||
|
||||
def create_data_dir(data_dir):
|
||||
try: os.stat(os.path.join(data_dir,'regtest'))
|
||||
|
|
@ -80,7 +80,7 @@ class MMGenRegtest(MMGenObject):
|
|||
def __init__(self,coin):
|
||||
self.coin = coin.lower()
|
||||
self.test_suite = os.getenv('MMGEN_TEST_SUITE_REGTEST')
|
||||
self.d = Daemon(self.coin+'_rt',test_suite=self.test_suite)
|
||||
self.d = CoinDaemon(self.coin+'_rt',test_suite=self.test_suite)
|
||||
|
||||
assert self.coin in self.coins,'{!r}: invalid coin for regtest'.format(user)
|
||||
|
||||
|
|
@ -127,7 +127,7 @@ class MMGenRegtest(MMGenObject):
|
|||
|
||||
assert user is None or user in self.users,'{!r}: invalid user for regtest'.format(user)
|
||||
|
||||
d = Daemon(self.coin+'_rt',test_suite=self.test_suite)
|
||||
d = CoinDaemon(self.coin+'_rt',test_suite=self.test_suite)
|
||||
|
||||
type(d).generate = RegtestDaemon.generate
|
||||
|
||||
|
|
|
|||
|
|
@ -174,9 +174,9 @@ def stop_test_daemons(*network_ids):
|
|||
def test_daemons_ops(*network_ids,op):
|
||||
if opt.no_daemon_autostart:
|
||||
return
|
||||
from mmgen.daemon import Daemon
|
||||
from mmgen.daemon import CoinDaemon
|
||||
silent = not opt.verbose and not (hasattr(opt,'exact_output') and opt.exact_output)
|
||||
for network_id in network_ids:
|
||||
if network_id not in Daemon.network_ids: # silently ignore invalid IDs
|
||||
if network_id not in CoinDaemon.network_ids: # silently ignore invalid IDs
|
||||
continue
|
||||
Daemon(network_id,test_suite=True).cmd(op,silent=silent)
|
||||
CoinDaemon(network_id,test_suite=True).cmd(op,silent=silent)
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@
|
|||
import sys
|
||||
from tests_header import repo_root
|
||||
from mmgen.common import *
|
||||
from mmgen.daemon import Daemon
|
||||
from mmgen.daemon import CoinDaemon
|
||||
from mmgen.regtest import MMGenRegtest
|
||||
|
||||
action = g.prog_name.split('-')[0]
|
||||
|
|
@ -32,7 +32,7 @@ Valid Regtest users: {ru}
|
|||
'code': {
|
||||
'options': lambda s: s.format(a=action.capitalize(),pn=g.prog_name),
|
||||
'notes': lambda s: s.format(
|
||||
nid=', '.join(Daemon.network_ids),
|
||||
nid=', '.join(CoinDaemon.network_ids),
|
||||
rid=', '.join(MMGenRegtest.coins),
|
||||
ru=', '.join(MMGenRegtest.users),
|
||||
)
|
||||
|
|
@ -47,7 +47,7 @@ if 'all' in cmd_args or 'no_xmr' in cmd_args:
|
|||
if opt.regtest_user:
|
||||
ids = MMGenRegtest.coins
|
||||
else:
|
||||
ids = list(Daemon.network_ids)
|
||||
ids = list(CoinDaemon.network_ids)
|
||||
if cmd_args[0] == 'no_xmr':
|
||||
ids.remove('xmr')
|
||||
else:
|
||||
|
|
@ -55,7 +55,7 @@ else:
|
|||
if not ids:
|
||||
opts.usage()
|
||||
for i in ids:
|
||||
if i not in Daemon.network_ids:
|
||||
if i not in CoinDaemon.network_ids:
|
||||
die(1,'{!r}: invalid network ID'.format(i))
|
||||
|
||||
if 'eth' in ids and 'etc' in ids:
|
||||
|
|
@ -69,7 +69,7 @@ for network_id in ids:
|
|||
else:
|
||||
if network_id.endswith('_rt'):
|
||||
continue
|
||||
d = Daemon(network_id,test_suite=True)
|
||||
d = CoinDaemon(network_id,test_suite=True)
|
||||
d.debug = opt.debug
|
||||
d.wait = not opt.no_wait
|
||||
if opt.get_state:
|
||||
|
|
|
|||
|
|
@ -77,7 +77,7 @@ try: os.unlink(os.path.join(repo_root,'my.err'))
|
|||
except: pass
|
||||
|
||||
from mmgen.common import *
|
||||
from mmgen.daemon import Daemon
|
||||
from mmgen.daemon import CoinDaemon
|
||||
from test.common import *
|
||||
from test.test_py_d.common import *
|
||||
|
||||
|
|
@ -156,7 +156,7 @@ network_id = get_network_id(get_coin(),bool(_uopts.get('testnet')))
|
|||
|
||||
sys.argv.insert(1,'--data-dir=' + data_dir)
|
||||
sys.argv.insert(1,'--daemon-data-dir=test/daemons/' + get_coin())
|
||||
sys.argv.insert(1,'--rpc-port={}'.format(Daemon(network_id,test_suite=True).rpc_port))
|
||||
sys.argv.insert(1,'--rpc-port={}'.format(CoinDaemon(network_id,test_suite=True).rpc_port))
|
||||
|
||||
# step 2: opts.init will create new data_dir in ./test (if not 'resume' or 'skip_deps'):
|
||||
usr_args = opts.init(opts_data)
|
||||
|
|
|
|||
|
|
@ -299,8 +299,8 @@ class TestSuiteEthdev(TestSuiteBase,TestSuiteShared):
|
|||
)
|
||||
|
||||
def __init__(self,trunner,cfgs,spawn):
|
||||
from mmgen.daemon import Daemon
|
||||
self.rpc_port = Daemon(g.coin,test_suite=True).rpc_port
|
||||
from mmgen.daemon import CoinDaemon
|
||||
self.rpc_port = CoinDaemon(g.coin,test_suite=True).rpc_port
|
||||
os.environ['MMGEN_BOGUS_WALLET_DATA'] = ''
|
||||
return TestSuiteBase.__init__(self,trunner,cfgs,spawn)
|
||||
|
||||
|
|
|
|||
|
|
@ -84,7 +84,7 @@ class TestSuiteRefAltcoin(TestSuiteRef,TestSuiteBase):
|
|||
self.write_to_tmpfile(pwfile,dfl_wpasswd)
|
||||
pf = joinpath(self.tmpdir,pwfile)
|
||||
from mmgen.protocol import init_coin
|
||||
from mmgen.daemon import Daemon
|
||||
from mmgen.daemon import CoinDaemon
|
||||
for k in ('bch','eth','mm1','etc'):
|
||||
coin,token = ('eth','mm1') if k == 'mm1' else (k,None)
|
||||
ref_subdir = self._get_ref_subdir_by_coin(coin)
|
||||
|
|
@ -97,7 +97,7 @@ class TestSuiteRefAltcoin(TestSuiteRef,TestSuiteBase):
|
|||
start_test_daemons(network_id)
|
||||
extra_opts += [
|
||||
'--daemon-data-dir=test/daemons/bch',
|
||||
'--rpc-port={}'.format(Daemon(network_id,test_suite=True).rpc_port) ]
|
||||
'--rpc-port={}'.format(CoinDaemon(network_id,test_suite=True).rpc_port) ]
|
||||
g.testnet = tn
|
||||
init_coin(coin)
|
||||
fn = TestSuiteRef.sources['ref_tx_file'][token or coin][bool(tn)]
|
||||
|
|
|
|||
|
|
@ -107,16 +107,16 @@ class unit_test(object):
|
|||
('bch',False,'test/ref/460D4D-BCH[10.19764,tl=1320969600].rawtx') )
|
||||
from mmgen.protocol import init_coin
|
||||
from mmgen.tx import MMGenTX
|
||||
from mmgen.daemon import Daemon
|
||||
from mmgen.daemon import CoinDaemon
|
||||
print_info('test/ref/*rawtx','MMGen reference transactions')
|
||||
for n,(coin,tn,fn) in enumerate(fns):
|
||||
init_coin(coin,tn)
|
||||
g.proto.daemon_data_dir = 'test/daemons/' + g.coin.lower()
|
||||
g.rpc_port = Daemon(coin + ('','_tn')[tn],test_suite=True).rpc_port
|
||||
g.rpc_port = CoinDaemon(coin + ('','_tn')[tn],test_suite=True).rpc_port
|
||||
rpc_init(reinit=True)
|
||||
test_tx(MMGenTX(fn).hex,fn,n+1)
|
||||
init_coin('btc',False)
|
||||
g.rpc_port = Daemon('btc',test_suite=True).rpc_port
|
||||
g.rpc_port = CoinDaemon('btc',test_suite=True).rpc_port
|
||||
rpc_init(reinit=True)
|
||||
Msg('OK')
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue