cmdtest_d.httpd: initialize with cfg
This commit is contained in:
parent
e9aeb9d8cd
commit
f44ca874ec
9 changed files with 14 additions and 14 deletions
|
|
@ -285,7 +285,7 @@ class CmdTestEthBump(CmdTestEthBumpMethods, CmdTestEthSwapMethods, CmdTestSwapMe
|
|||
|
||||
globals()[self.cross_group] = self.create_cross_runner(trunner)
|
||||
|
||||
self.swap_server = ThornodeSwapServer()
|
||||
self.swap_server = ThornodeSwapServer(cfg)
|
||||
self.swap_server.start()
|
||||
|
||||
def txcreate1(self):
|
||||
|
|
|
|||
|
|
@ -66,7 +66,7 @@ from .base import CmdTestBase
|
|||
from .shared import CmdTestShared
|
||||
from .httpd.etherscan import EtherscanServer
|
||||
|
||||
etherscan_server = EtherscanServer()
|
||||
etherscan_server = EtherscanServer(cfg)
|
||||
|
||||
del_addrs = ('4', '1')
|
||||
|
||||
|
|
|
|||
|
|
@ -260,7 +260,7 @@ class CmdTestEthSwap(CmdTestSwapMethods, CmdTestRegtest):
|
|||
trunner,
|
||||
add_cfg = {'eth_daemon_id': trunner.cfg.eth_daemon_id})
|
||||
|
||||
self.swap_server = ThornodeSwapServer()
|
||||
self.swap_server = ThornodeSwapServer(cfg)
|
||||
self.swap_server.start()
|
||||
|
||||
TestProxy(self, cfg)
|
||||
|
|
|
|||
|
|
@ -24,6 +24,9 @@ class SilentRequestHandler(WSGIRequestHandler):
|
|||
|
||||
class HTTPD:
|
||||
|
||||
def __init__(self, cfg):
|
||||
self.cfg = cfg
|
||||
|
||||
def start(self):
|
||||
|
||||
if port_in_use(self.port):
|
||||
|
|
|
|||
|
|
@ -15,7 +15,6 @@ test.cmdtest_d.httpd.thornode.swap: Thornode swap HTTP server
|
|||
import time, re, json
|
||||
from wsgiref.util import request_uri
|
||||
|
||||
from mmgen.cfg import Config
|
||||
from mmgen.amt import UniAmt
|
||||
from mmgen.protocol import init_proto
|
||||
|
||||
|
|
@ -23,8 +22,6 @@ from ...include.common import eth_inbound_addr, thorchain_router_addr_file
|
|||
|
||||
from . import ThornodeServer
|
||||
|
||||
cfg = Config()
|
||||
|
||||
# https://thornode.ninerealms.com/thorchain/quote/swap?from_asset=BCH.BCH&to_asset=LTC.LTC&amount=1000000
|
||||
prices = {'BTC': 97000, 'LTC': 115, 'BCH': 330, 'ETH': 2304, 'MM1': 0.998, 'RUNE': 1.4}
|
||||
gas_rate_units = {'ETH': 'gwei', 'BTC': 'satsperbyte'}
|
||||
|
|
@ -117,7 +114,7 @@ data_template_eth = {
|
|||
'total_swap_seconds': 24
|
||||
}
|
||||
|
||||
def make_inbound_addr(proto, mmtype):
|
||||
def make_inbound_addr(cfg, proto, mmtype):
|
||||
if proto.is_evm:
|
||||
return '0x' + eth_inbound_addr # non-checksummed as per ninerealms thornode
|
||||
else:
|
||||
|
|
@ -155,15 +152,15 @@ class ThornodeSwapServer(ThornodeServer):
|
|||
}
|
||||
|
||||
if send_asset != 'RUNE':
|
||||
send_proto = init_proto(cfg, send_chain, network='regtest', need_amt=True)
|
||||
send_proto = init_proto(self.cfg, send_chain, network='regtest', need_amt=True)
|
||||
data.update({
|
||||
'inbound_address': make_inbound_addr(send_proto, send_proto.preferred_mmtypes[0]),
|
||||
'inbound_address': make_inbound_addr(self.cfg, send_proto, send_proto.preferred_mmtypes[0]),
|
||||
'gas_rate_units': gas_rate_units[send_proto.base_proto_coin],
|
||||
'recommended_gas_rate': recommended_gas_rate[send_proto.base_proto_coin]
|
||||
})
|
||||
|
||||
if send_asset == 'MM1':
|
||||
eth_proto = init_proto(cfg, 'eth', network='regtest')
|
||||
eth_proto = init_proto(self.cfg, 'eth', network='regtest')
|
||||
with open(thorchain_router_addr_file) as fh:
|
||||
raw_addr = fh.read().strip()
|
||||
data['router'] = '0x' + eth_proto.checksummed_addr(raw_addr)
|
||||
|
|
|
|||
|
|
@ -70,7 +70,7 @@ class CmdTestRune(CmdTestEthdevMethods, CmdTestBase, CmdTestShared):
|
|||
self.proto = init_proto(cfg, network_id=self.proto.coin + '_rt', need_amt=True)
|
||||
self.spawn_env['MMGEN_BOGUS_SEND'] = ''
|
||||
|
||||
self.rpc_server = ThornodeRPCServer()
|
||||
self.rpc_server = ThornodeRPCServer(cfg)
|
||||
self.rpc_server.start()
|
||||
|
||||
TestProxy(self, cfg)
|
||||
|
|
|
|||
|
|
@ -78,7 +78,7 @@ class CmdTestRuneSwap(CmdTestSwapMethods, CmdTestRegtest):
|
|||
|
||||
globals()[self.cross_group] = self.create_cross_runner(trunner)
|
||||
|
||||
self.swap_server = ThornodeSwapServer()
|
||||
self.swap_server = ThornodeSwapServer(cfg)
|
||||
self.swap_server.start()
|
||||
|
||||
TestProxy(self, cfg)
|
||||
|
|
|
|||
|
|
@ -469,7 +469,7 @@ class CmdTestSwap(CmdTestSwapMethods, CmdTestRegtest, CmdTestAutosignThreaded):
|
|||
|
||||
self.protos = [init_proto(cfg, k, network='regtest', need_amt=True) for k in ('btc', 'ltc', 'bch')]
|
||||
|
||||
self.swap_server = ThornodeSwapServer()
|
||||
self.swap_server = ThornodeSwapServer(cfg)
|
||||
self.swap_server.start()
|
||||
|
||||
self.opts.append('--bob')
|
||||
|
|
|
|||
|
|
@ -209,7 +209,7 @@ class unit_tests:
|
|||
regtest_cfg = Config({'coin': 'rune', 'regtest': True, 'test_suite': True})
|
||||
end_silence()
|
||||
|
||||
thornode_server = ThornodeRPCServer()
|
||||
thornode_server = ThornodeRPCServer(test_cfg)
|
||||
thornode_server.start()
|
||||
|
||||
addr = 'thor1lukwlve7hayy66qrdkp4k7sh0emjqwergy7tl3'
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue