|
@@ -58,7 +58,9 @@ from .common import (
|
|
|
)
|
|
|
from .ct_base import CmdTestBase
|
|
|
from .ct_shared import CmdTestShared
|
|
|
-from .etherscan import run_etherscan_server
|
|
|
+from .httpd.etherscan import EtherscanServer
|
|
|
+
|
|
|
+etherscan_server = EtherscanServer()
|
|
|
|
|
|
del_addrs = ('4', '1')
|
|
|
dfl_sid = '98831F3A'
|
|
@@ -179,12 +181,6 @@ token_bals_getbalance = lambda k: {
|
|
|
|
|
|
coin = cfg.coin
|
|
|
|
|
|
-def etherscan_server_start():
|
|
|
- import threading
|
|
|
- t = threading.Thread(target=run_etherscan_server, name='Etherscan server thread')
|
|
|
- t.daemon = True
|
|
|
- t.start()
|
|
|
-
|
|
|
class CmdTestEthdev(CmdTestBase, CmdTestShared):
|
|
|
'Ethereum transacting, token deployment and tracking wallet operations'
|
|
|
networks = ('eth', 'etc')
|
|
@@ -244,8 +240,12 @@ class CmdTestEthdev(CmdTestBase, CmdTestShared):
|
|
|
('txview1_sig', 'viewing the signed transaction'),
|
|
|
('tx_status0_bad', 'getting the transaction status'),
|
|
|
('txsign1_ni', 'signing the transaction (non-interactive)'),
|
|
|
+
|
|
|
+ ('etherscan_server_start','starting the Etherscan server'),
|
|
|
('txsend_etherscan_test','sending the transaction via Etherscan (simulation, with --test)'),
|
|
|
('txsend_etherscan', 'sending the transaction via Etherscan (simulation)'),
|
|
|
+ ('etherscan_server_stop','stopping the Etherscan server'),
|
|
|
+
|
|
|
('txsend1', 'sending the transaction'),
|
|
|
('bal1', f'the {coin} balance'),
|
|
|
|
|
@@ -459,9 +459,6 @@ class CmdTestEthdev(CmdTestBase, CmdTestShared):
|
|
|
self.message = 'attack at dawn'
|
|
|
self.spawn_env['MMGEN_BOGUS_SEND'] = ''
|
|
|
|
|
|
- if type(self) is CmdTestEthdev:
|
|
|
- etherscan_server_start() # TODO: stop server when test group finishes executing
|
|
|
-
|
|
|
@property
|
|
|
async def rpc(self):
|
|
|
from mmgen.rpc import rpc_init
|
|
@@ -778,10 +775,20 @@ class CmdTestEthdev(CmdTestBase, CmdTestShared):
|
|
|
return self.tx_status(ext='{}.regtest.sigtx', expect_str='neither in mempool nor blockchain', exit_val=1)
|
|
|
def txsign1_ni(self):
|
|
|
return self.txsign(ni=True, dev_send=True)
|
|
|
+
|
|
|
+ def etherscan_server_start(self):
|
|
|
+ self.spawn(msg_only=True)
|
|
|
+ etherscan_server.start()
|
|
|
+ return 'ok'
|
|
|
def txsend_etherscan_test(self):
|
|
|
return self.txsend(add_args=['--tx-proxy=ether', '--test'], test='tx_proxy')
|
|
|
def txsend_etherscan(self):
|
|
|
return self.txsend(add_args=['--tx-proxy=ethersc'])
|
|
|
+ def etherscan_server_stop(self):
|
|
|
+ self.spawn(msg_only=True)
|
|
|
+ etherscan_server.stop()
|
|
|
+ return 'ok'
|
|
|
+
|
|
|
def txsend1(self):
|
|
|
return self.txsend()
|
|
|
def txview1_sig(self): # do after send so that TxID is displayed
|