removed hard coded ipv4 and replaced it with being able to provide hostname to --spv

This commit is contained in:
Lex Berezhny 2019-01-15 00:22:55 -05:00
parent 355989d6d1
commit 7a8c2fc98b
2 changed files with 7 additions and 5 deletions

View file

@ -18,9 +18,9 @@ def get_argument_parser():
subparsers.add_parser("download", help="Download blockchain node binary.") subparsers.add_parser("download", help="Download blockchain node binary.")
start = subparsers.add_parser("start", help="Start orchstr8 service.") start = subparsers.add_parser("start", help="Start orchstr8 service.")
start.add_argument("--blockchain", help="Start blockchain node.", action="store_true") start.add_argument("--blockchain", help="Hostname to start blockchain node.")
start.add_argument("--spv", help="Start SPV server.", action="store_true") start.add_argument("--spv", help="Hostname to start SPV server.")
start.add_argument("--wallet", help="Start wallet daemon.", action="store_true") start.add_argument("--wallet", help="Hostname to start wallet daemon.")
generate = subparsers.add_parser("generate", help="Call generate method on running orchstr8 instance.") generate = subparsers.add_parser("generate", help="Call generate method on running orchstr8 instance.")
generate.add_argument("blocks", type=int, help="Number of blocks to generate") generate.add_argument("blocks", type=int, help="Number of blocks to generate")
@ -62,10 +62,13 @@ def main():
conductor = Conductor() conductor = Conductor()
if getattr(args, 'blockchain', False): if getattr(args, 'blockchain', False):
conductor.blockchain_node.hostname = args.blockchain
loop.run_until_complete(conductor.start_blockchain()) loop.run_until_complete(conductor.start_blockchain())
if getattr(args, 'spv', False): if getattr(args, 'spv', False):
conductor.spv_node.hostname = args.spv
loop.run_until_complete(conductor.start_spv()) loop.run_until_complete(conductor.start_spv())
if getattr(args, 'wallet', False): if getattr(args, 'wallet', False):
conductor.wallet_node.hostname = args.wallet
loop.run_until_complete(conductor.start_wallet()) loop.run_until_complete(conductor.start_wallet())
service = ConductorService(conductor, loop) service = ConductorService(conductor, loop)

View file

@ -16,7 +16,6 @@ import os
import pylru import pylru
import ssl import ssl
import time import time
import socket
from asyncio import Event, sleep from asyncio import Event, sleep
from collections import defaultdict from collections import defaultdict
from functools import partial from functools import partial
@ -148,7 +147,7 @@ class SessionManager:
protocol_class = self.env.coin.SESSIONCLS protocol_class = self.env.coin.SESSIONCLS
protocol_factory = partial(protocol_class, self, self.db, protocol_factory = partial(protocol_class, self, self.db,
self.mempool, self.peer_mgr, kind) self.mempool, self.peer_mgr, kind)
server = loop.create_server(protocol_factory, *args, family=socket.AF_INET, **kw_args) server = loop.create_server(protocol_factory, *args, **kw_args)
host, port = args[:2] host, port = args[:2]
try: try: