From 1564536c503206b6ffac4fddcbea1f7c00735c3e Mon Sep 17 00:00:00 2001 From: Roy Lee Date: Mon, 8 Nov 2021 16:19:36 -0800 Subject: [PATCH] test: migrate from lbrycrd to lbcd/lbcwallet --- lbry/testcase.py | 12 +- lbry/wallet/__init__.py | 15 +- lbry/wallet/orchstr8/cli.py | 21 +- lbry/wallet/orchstr8/node.py | 279 +++++++++++++++--- lbry/wallet/orchstr8/service.py | 14 +- tests/integration/blockchain/test_network.py | 8 +- .../blockchain/test_wallet_commands.py | 2 +- .../integration/claims/test_claim_commands.py | 2 +- .../takeovers/test_resolve_command.py | 2 +- 9 files changed, 281 insertions(+), 74 deletions(-) diff --git a/lbry/testcase.py b/lbry/testcase.py index 6f54c5544..d89654a24 100644 --- a/lbry/testcase.py +++ b/lbry/testcase.py @@ -19,7 +19,7 @@ from lbry.conf import Config from lbry.wallet.util import satoshis_to_coins from lbry.wallet.dewies import lbc_to_dewies from lbry.wallet.orchstr8 import Conductor -from lbry.wallet.orchstr8.node import BlockchainNode, WalletNode, HubNode +from lbry.wallet.orchstr8.node import LBCWalletNode, WalletNode, HubNode from lbry.schema.claim import Claim from lbry.extras.daemon.daemon import Daemon, jsonrpc_dumps_pretty @@ -230,7 +230,7 @@ class IntegrationTestCase(AsyncioTestCase): def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) self.conductor: Optional[Conductor] = None - self.blockchain: Optional[BlockchainNode] = None + self.blockchain: Optional[LBCWalletNode] = None self.hub: Optional[HubNode] = None self.wallet_node: Optional[WalletNode] = None self.manager: Optional[WalletManager] = None @@ -240,15 +240,17 @@ class IntegrationTestCase(AsyncioTestCase): async def asyncSetUp(self): self.conductor = Conductor(seed=self.SEED) - await self.conductor.start_blockchain() - self.addCleanup(self.conductor.stop_blockchain) + await self.conductor.start_lbcd() + self.addCleanup(self.conductor.stop_lbcd) + await self.conductor.start_lbcwallet() + self.addCleanup(self.conductor.stop_lbcwallet) await self.conductor.start_spv() self.addCleanup(self.conductor.stop_spv) await self.conductor.start_wallet() self.addCleanup(self.conductor.stop_wallet) await self.conductor.start_hub() self.addCleanup(self.conductor.stop_hub) - self.blockchain = self.conductor.blockchain_node + self.blockchain = self.conductor.lbcwallet_node self.hub = self.conductor.hub_node self.wallet_node = self.conductor.wallet_node self.manager = self.wallet_node.manager diff --git a/lbry/wallet/__init__.py b/lbry/wallet/__init__.py index 5f2fffa21..a7d42521d 100644 --- a/lbry/wallet/__init__.py +++ b/lbry/wallet/__init__.py @@ -1,8 +1,13 @@ -__node_daemon__ = 'lbrycrdd' -__node_cli__ = 'lbrycrd-cli' -__node_bin__ = '' -__node_url__ = ( - 'https://github.com/lbryio/lbrycrd/releases/download/v0.17.4.6/lbrycrd-linux-1746.zip' +__lbcd__ = 'lbcd' +__lbcctl__ = 'lbcctl' +__lbcwallet__ = 'lbcwallet' +__lbcd_url__ = ( + 'https://github.com/lbryio/lbcd/releases/download/' + + 'v0.22.100-beta-rc1/lbcd_0.22.100-beta-rc1_TARGET_PLATFORM.tar.gz' +) +__lbcwallet_url__ = ( + 'https://github.com/lbryio/lbcwallet/releases/download/' + + 'v0.12.100-alpha-rc1/lbcwallet_0.12.100-alpha-rc1_TARGET_PLATFORM.tar.gz' ) __spvserver__ = 'lbry.wallet.server.coin.LBCRegTest' diff --git a/lbry/wallet/orchstr8/cli.py b/lbry/wallet/orchstr8/cli.py index ee4ddc60c..f75216882 100644 --- a/lbry/wallet/orchstr8/cli.py +++ b/lbry/wallet/orchstr8/cli.py @@ -5,7 +5,9 @@ import aiohttp from lbry import wallet from lbry.wallet.orchstr8.node import ( - Conductor, get_blockchain_node_from_ledger + Conductor, + get_lbcd_node_from_ledger, + get_lbcwallet_node_from_ledger ) from lbry.wallet.orchstr8.service import ConductorService @@ -16,10 +18,11 @@ def get_argument_parser(): ) subparsers = parser.add_subparsers(dest='command', help='sub-command help') - subparsers.add_parser("download", help="Download blockchain node binary.") + subparsers.add_parser("download", help="Download lbcd and lbcwallet node binaries.") start = subparsers.add_parser("start", help="Start orchstr8 service.") - start.add_argument("--blockchain", help="Hostname to start blockchain node.") + start.add_argument("--lbcd", help="Hostname to start lbcd node.") + start.add_argument("--lbcwallet", help="Hostname to start lbcwallet node.") start.add_argument("--spv", help="Hostname to start SPV server.") start.add_argument("--wallet", help="Hostname to start wallet daemon.") @@ -47,7 +50,8 @@ def main(): if command == 'download': logging.getLogger('blockchain').setLevel(logging.INFO) - get_blockchain_node_from_ledger(wallet).ensure() + get_lbcd_node_from_ledger(wallet).ensure() + get_lbcwallet_node_from_ledger(wallet).ensure() elif command == 'generate': loop.run_until_complete(run_remote_command( @@ -57,9 +61,12 @@ def main(): elif command == 'start': conductor = Conductor() - if getattr(args, 'blockchain', False): - conductor.blockchain_node.hostname = args.blockchain - loop.run_until_complete(conductor.start_blockchain()) + if getattr(args, 'lbcd', False): + conductor.lbcd_node.hostname = args.lbcd + loop.run_until_complete(conductor.start_lbcd()) + if getattr(args, 'lbcwallet', False): + conductor.lbcwallet_node.hostname = args.lbcwallet + loop.run_until_complete(conductor.start_lbcwallet()) if getattr(args, 'spv', False): conductor.spv_node.hostname = args.spv loop.run_until_complete(conductor.start_spv()) diff --git a/lbry/wallet/orchstr8/node.py b/lbry/wallet/orchstr8/node.py index 7ea980fca..f3227d3ff 100644 --- a/lbry/wallet/orchstr8/node.py +++ b/lbry/wallet/orchstr8/node.py @@ -8,6 +8,7 @@ import logging import tempfile import subprocess import importlib +import platform from distutils.util import strtobool from binascii import hexlify @@ -31,11 +32,18 @@ def get_spvserver_from_ledger(ledger_module): return getattr(spvserver_module, regtest_class_name) -def get_blockchain_node_from_ledger(ledger_module): - return BlockchainNode( - ledger_module.__node_url__, - os.path.join(ledger_module.__node_bin__, ledger_module.__node_daemon__), - os.path.join(ledger_module.__node_bin__, ledger_module.__node_cli__) +def get_lbcd_node_from_ledger(ledger_module): + return LBCDNode( + ledger_module.__lbcd_url__, + ledger_module.__lbcd__, + ledger_module.__lbcctl__ + ) + +def get_lbcwallet_node_from_ledger(ledger_module): + return LBCWalletNode( + ledger_module.__lbcwallet_url__, + ledger_module.__lbcwallet__, + ledger_module.__lbcctl__ ) @@ -45,36 +53,37 @@ class Conductor: self.manager_module = WalletManager self.spv_module = get_spvserver_from_ledger(lbry.wallet) - self.blockchain_node = get_blockchain_node_from_ledger(lbry.wallet) + self.lbcd_node = get_lbcd_node_from_ledger(lbry.wallet) + self.lbcwallet_node = get_lbcwallet_node_from_ledger(lbry.wallet) self.spv_node = SPVNode(self.spv_module) self.wallet_node = WalletNode( self.manager_module, RegTestLedger, default_seed=seed ) self.hub_node = HubNode(__hub_url__, "hub", self.spv_node) - self.blockchain_started = False + self.lbcd_started = False + self.lbcwallet_started = False self.spv_started = False self.wallet_started = False self.hub_started = False self.log = log.getChild('conductor') - async def start_blockchain(self): - if not self.blockchain_started: - asyncio.create_task(self.blockchain_node.start()) - await self.blockchain_node.running.wait() - await self.blockchain_node.generate(200) - self.blockchain_started = True + async def start_lbcd(self): + if not self.lbcd_started: + asyncio.create_task(self.lbcd_node.start()) + await self.lbcd_node.running.wait() + self.lbcd_started = True - async def stop_blockchain(self): - if self.blockchain_started: - await self.blockchain_node.stop(cleanup=True) - self.blockchain_started = False + async def stop_lbcd(self): + if self.lbcd_started: + await self.lbcd_node.stop(cleanup=True) + self.lbcd_started = False async def start_hub(self): if not self.hub_started: asyncio.create_task(self.hub_node.start()) - await self.blockchain_node.running.wait() + await self.lbcwallet_node.running.wait() self.hub_started = True async def stop_hub(self): @@ -84,7 +93,7 @@ class Conductor: async def start_spv(self): if not self.spv_started: - await self.spv_node.start(self.blockchain_node) + await self.spv_node.start(self.lbcwallet_node) self.spv_started = True async def stop_spv(self): @@ -102,8 +111,25 @@ class Conductor: await self.wallet_node.stop(cleanup=True) self.wallet_started = False + async def start_lbcwallet(self): + if not self.lbcwallet_started: + asyncio.create_task(self.lbcwallet_node.start()) + await self.lbcwallet_node.running.wait() + mining_addr = await self.lbcwallet_node.get_new_address('default') + self.lbcwallet_node.mining_addr = mining_addr + await self.lbcwallet_node.generate(200) + # unlock the wallet for the next 1 hour + await self.lbcwallet_node.wallet_passphrase("password", 3600) + self.lbcwallet_started = True + + async def stop_lbcwallet(self): + if self.lbcwallet_started: + await self.lbcwallet_node.stop(cleanup=True) + self.lbcwallet_started = False + async def start(self): - await self.start_blockchain() + await self.start_lbcd() + await self.start_lbcwallet() await self.start_spv() await self.start_wallet() @@ -111,7 +137,8 @@ class Conductor: all_the_stops = [ self.stop_wallet, self.stop_spv, - self.stop_blockchain + self.stop_lbcwallet, + self.stop_lbcd ] for stop in all_the_stops: try: @@ -198,14 +225,14 @@ class SPVNode: self.stopped = False self.index_name = uuid4().hex - async def start(self, blockchain_node: 'BlockchainNode', extraconf=None): + async def start(self, lbcwallet_node: 'LBCWalletNode', extraconf=None): self.data_path = tempfile.mkdtemp() conf = { 'DESCRIPTION': '', 'PAYMENT_ADDRESS': '', 'DAILY_FEE': '0', 'DB_DIRECTORY': self.data_path, - 'DAEMON_URL': blockchain_node.rpc_url, + 'DAEMON_URL': lbcwallet_node.rpc_url, 'REORG_LIMIT': '100', 'HOST': self.hostname, 'TCP_PORT': str(self.port), @@ -240,7 +267,7 @@ class SPVNode: shutil.rmtree(self.data_path, ignore_errors=True) -class BlockchainProcess(asyncio.SubprocessProtocol): +class LBCDProcess(asyncio.SubprocessProtocol): IGNORE_OUTPUT = [ b'keypool keep', @@ -251,7 +278,7 @@ class BlockchainProcess(asyncio.SubprocessProtocol): def __init__(self): self.ready = asyncio.Event() self.stopped = asyncio.Event() - self.log = log.getChild('blockchain') + self.log = log.getChild('lbcd') def pipe_data_received(self, fd, data): if self.log and not any(ignore in data for ignore in self.IGNORE_OUTPUT): @@ -262,7 +289,7 @@ class BlockchainProcess(asyncio.SubprocessProtocol): if b'Error:' in data: self.ready.set() raise SystemError(data.decode()) - if b'Done loading' in data: + if b'RPCS: RPC server listening on' in data: self.ready.set() def process_exited(self): @@ -270,7 +297,34 @@ class BlockchainProcess(asyncio.SubprocessProtocol): self.ready.set() -class BlockchainNode: +class WalletProcess(asyncio.SubprocessProtocol): + + IGNORE_OUTPUT = [ + ] + + def __init__(self): + self.ready = asyncio.Event() + self.stopped = asyncio.Event() + self.log = log.getChild('lbcwallet') + self.transport: Optional[asyncio.transports.SubprocessTransport] = None + + def pipe_data_received(self, fd, data): + if self.log and not any(ignore in data for ignore in self.IGNORE_OUTPUT): + if b'Error:' in data: + self.log.error(data.decode()) + else: + self.log.info(data.decode()) + if b'Error:' in data: + self.ready.set() + raise SystemError(data.decode()) + if b'WLLT: Finished rescan' in data: + self.ready.set() + + def process_exited(self): + self.stopped.set() + self.ready.set() + +class LBCDNode: P2SH_SEGWIT_ADDRESS = "p2sh-segwit" BECH32_ADDRESS = "bech32" @@ -281,14 +335,13 @@ class BlockchainNode: self.bin_dir = os.path.join(self.project_dir, 'bin') self.daemon_bin = os.path.join(self.bin_dir, daemon) self.cli_bin = os.path.join(self.bin_dir, cli) - self.log = log.getChild('blockchain') - self.data_path = None + self.log = log.getChild('lbcd') + self.data_path = tempfile.mkdtemp() self.protocol = None self.transport = None - self.block_expected = 0 self.hostname = 'localhost' - self.peerport = 9246 + 2 # avoid conflict with default peer port - self.rpcport = 9245 + 2 # avoid conflict with default rpc port + self.peerport = 29246 + self.rpcport = 29245 self.rpcuser = 'rpcuser' self.rpcpassword = 'rpcpassword' self.stopped = False @@ -300,9 +353,6 @@ class BlockchainNode: def rpc_url(self): return f'http://{self.rpcuser}:{self.rpcpassword}@{self.hostname}:{self.rpcport}/' - def is_expected_block(self, e: BlockHeightEvent): - return self.block_expected == e.height - @property def exists(self): return ( @@ -311,6 +361,12 @@ class BlockchainNode: ) def download(self): + uname = platform.uname() + target_os = str.lower(uname.system) + target_arch = str.replace(uname.machine, 'x86_64', 'amd64') + target_platform = target_os + '_' + target_arch + self.latest_release_url = str.replace(self.latest_release_url, 'TARGET_PLATFORM', target_platform) + downloaded_file = os.path.join( self.bin_dir, self.latest_release_url[self.latest_release_url.rfind('/')+1:] @@ -345,14 +401,14 @@ class BlockchainNode: async def start(self): assert self.ensure() - self.data_path = tempfile.mkdtemp() loop = asyncio.get_event_loop() asyncio.get_child_watcher().attach_loop(loop) command = [ self.daemon_bin, - f'-datadir={self.data_path}', '-printtoconsole', '-regtest', '-server', '-txindex', - f'-rpcuser={self.rpcuser}', f'-rpcpassword={self.rpcpassword}', f'-rpcport={self.rpcport}', - f'-port={self.peerport}' + '--notls', + f'--datadir={self.data_path}', + '--regtest', f'--listen=127.0.0.1:{self.peerport}', f'--rpclisten=127.0.0.1:{self.rpcport}', + '--txindex', f'--rpcuser={self.rpcuser}', f'--rpcpass={self.rpcpassword}' ] self.log.info(' '.join(command)) while not self.stopped: @@ -362,7 +418,7 @@ class BlockchainNode: await self.restart_ready.wait() try: self.transport, self.protocol = await loop.subprocess_exec( - BlockchainProcess, *command + LBCDProcess, *command ) await self.protocol.ready.wait() assert not self.protocol.stopped.is_set() @@ -372,7 +428,7 @@ class BlockchainNode: raise except Exception as e: self.running.clear() - log.exception('failed to start lbrycrdd', exc_info=e) + log.exception('failed to start lbcd', exc_info=e) async def stop(self, cleanup=True): self.stopped = True @@ -397,10 +453,143 @@ class BlockchainNode: def cleanup(self): shutil.rmtree(self.data_path, ignore_errors=True) + +class LBCWalletNode: + def __init__(self, url, lbcwallet, cli): + self.latest_release_url = url + self.project_dir = os.path.dirname(os.path.dirname(__file__)) + self.bin_dir = os.path.join(self.project_dir, 'bin') + self.lbcwallet_bin = os.path.join(self.bin_dir, lbcwallet) + self.cli_bin = os.path.join(self.bin_dir, cli) + self.log = log.getChild('lbcwallet') + self.protocol = None + self.transport = None + self.hostname = 'localhost' + self.lbcd_rpcport = 29245 + self.lbcwallet_rpcport = 29244 + self.rpcuser = 'rpcuser' + self.rpcpassword = 'rpcpassword' + self.data_path = tempfile.mkdtemp() + self.stopped = False + self.restart_ready = asyncio.Event() + self.restart_ready.set() + self.running = asyncio.Event() + self.block_expected = 0 + self.mining_addr = '' + + @property + def rpc_url(self): + return f'http://{self.rpcuser}:{self.rpcpassword}@{self.hostname}:{self.lbcwallet_rpcport}/' + + def is_expected_block(self, e: BlockHeightEvent): + return self.block_expected == e.height + + @property + def exists(self): + return ( + os.path.exists(self.lbcwallet_bin) + ) + + def download(self): + uname = platform.uname() + target_os = str.lower(uname.system) + target_arch = str.replace(uname.machine, 'x86_64', 'amd64') + target_platform = target_os + '_' + target_arch + self.latest_release_url = str.replace(self.latest_release_url, 'TARGET_PLATFORM', target_platform) + + downloaded_file = os.path.join( + self.bin_dir, + self.latest_release_url[self.latest_release_url.rfind('/')+1:] + ) + + if not os.path.exists(self.bin_dir): + os.mkdir(self.bin_dir) + + if not os.path.exists(downloaded_file): + self.log.info('Downloading: %s', self.latest_release_url) + with urllib.request.urlopen(self.latest_release_url) as response: + with open(downloaded_file, 'wb') as out_file: + shutil.copyfileobj(response, out_file) + + self.log.info('Extracting: %s', downloaded_file) + + if downloaded_file.endswith('.zip'): + with zipfile.ZipFile(downloaded_file) as dotzip: + dotzip.extractall(self.bin_dir) + # zipfile bug https://bugs.python.org/issue15795 + os.chmod(self.lbcwallet_bin, 0o755) + + elif downloaded_file.endswith('.tar.gz'): + with tarfile.open(downloaded_file) as tar: + tar.extractall(self.bin_dir) + + return self.exists + + def ensure(self): + return self.exists or self.download() + + async def start(self): + assert self.ensure() + loop = asyncio.get_event_loop() + asyncio.get_child_watcher().attach_loop(loop) + + command = [ + self.lbcwallet_bin, + '--noservertls', '--noclienttls', + '--regtest', + f'--rpcconnect=127.0.0.1:{self.lbcd_rpcport}', f'--rpclisten=127.0.0.1:{self.lbcwallet_rpcport}', + '--createtemp', f'--appdata={self.data_path}', + f'--username={self.rpcuser}', f'--password={self.rpcpassword}' + ] + self.log.info(' '.join(command)) + while not self.stopped: + if self.running.is_set(): + await asyncio.sleep(1) + continue + await self.restart_ready.wait() + try: + self.transport, self.protocol = await loop.subprocess_exec( + WalletProcess, *command + ) + self.protocol.transport = self.transport + await self.protocol.ready.wait() + assert not self.protocol.stopped.is_set() + self.running.set() + except asyncio.CancelledError: + self.running.clear() + raise + except Exception as e: + self.running.clear() + log.exception('failed to start lbcwallet', exc_info=e) + + def cleanup(self): + shutil.rmtree(self.data_path, ignore_errors=True) + + async def stop(self, cleanup=True): + self.stopped = True + try: + self.transport.terminate() + await self.protocol.stopped.wait() + self.transport.close() + finally: + if cleanup: + self.cleanup() + + async def clear_mempool(self): + self.restart_ready.clear() + self.transport.terminate() + await self.protocol.stopped.wait() + self.transport.close() + self.running.clear() + os.remove(os.path.join(self.data_path, 'regtest', 'mempool.dat')) + self.restart_ready.set() + await self.running.wait() + + async def _cli_cmnd(self, *args): cmnd_args = [ - self.cli_bin, f'-datadir={self.data_path}', '-regtest', - f'-rpcuser={self.rpcuser}', f'-rpcpassword={self.rpcpassword}', f'-rpcport={self.rpcport}' + self.cli_bin, + f'--rpcuser={self.rpcuser}', f'--rpcpass={self.rpcpassword}', '--notls', '--regtest', '--wallet' ] + list(args) self.log.info(' '.join(cmnd_args)) loop = asyncio.get_event_loop() @@ -417,14 +606,14 @@ class BlockchainNode: def generate(self, blocks): self.block_expected += blocks - return self._cli_cmnd('generate', str(blocks)) + return self._cli_cmnd('generatetoaddress', str(blocks), self.mining_addr) def generate_to_address(self, blocks, addr): self.block_expected += blocks return self._cli_cmnd('generatetoaddress', str(blocks), addr) def wallet_passphrase(self, passphrase, timeout): - return self._cli_cmnd('walletpassphrase', passphrase, str(timeout)) + return self._cli_cmnd('walletpassphrase', passphrase, str(timeout)) def invalidate_block(self, blockhash): return self._cli_cmnd('invalidateblock', blockhash) diff --git a/lbry/wallet/orchstr8/service.py b/lbry/wallet/orchstr8/service.py index 495f68a07..032a35ac0 100644 --- a/lbry/wallet/orchstr8/service.py +++ b/lbry/wallet/orchstr8/service.py @@ -61,8 +61,10 @@ class ConductorService: #set_logging( # self.stack.ledger_module, logging.DEBUG, WebSocketLogHandler(self.send_message) #) - self.stack.blockchain_started or await self.stack.start_blockchain() - self.send_message({'type': 'service', 'name': 'blockchain', 'port': self.stack.blockchain_node.port}) + self.stack.lbcd_started or await self.stack.start_lbcd() + self.send_message({'type': 'service', 'name': 'lbcd', 'port': self.stack.lbcd_node.port}) + self.stack.lbcwallet_started or await self.stack.start_lbcwallet() + self.send_message({'type': 'service', 'name': 'lbcwallet', 'port': self.stack.lbcwallet_node.port}) self.stack.spv_started or await self.stack.start_spv() self.send_message({'type': 'service', 'name': 'spv', 'port': self.stack.spv_node.port}) self.stack.wallet_started or await self.stack.start_wallet() @@ -74,7 +76,7 @@ class ConductorService: async def generate(self, request): data = await request.post() blocks = data.get('blocks', 1) - await self.stack.blockchain_node.generate(int(blocks)) + await self.stack.lbcwallet_node.generate(int(blocks)) return json_response({'blocks': blocks}) async def transfer(self, request): @@ -85,7 +87,7 @@ class ConductorService: if not address: raise ValueError("No address was provided.") amount = data.get('amount', 1) - txid = await self.stack.blockchain_node.send_to_address(address, amount) + txid = await self.stack.lbcwallet_node.send_to_address(address, amount) if self.stack.wallet_started: await self.stack.wallet_node.ledger.on_transaction.where( lambda e: e.tx.id == txid and e.address == address @@ -98,7 +100,7 @@ class ConductorService: async def balance(self, _): return json_response({ - 'balance': await self.stack.blockchain_node.get_balance() + 'balance': await self.stack.lbcwallet_node.get_balance() }) async def log(self, request): @@ -129,7 +131,7 @@ class ConductorService: 'type': 'status', 'height': self.stack.wallet_node.ledger.headers.height, 'balance': satoshis_to_coins(await self.stack.wallet_node.account.get_balance()), - 'miner': await self.stack.blockchain_node.get_balance() + 'miner': await self.stack.lbcwallet_node.get_balance() }) def send_message(self, msg): diff --git a/tests/integration/blockchain/test_network.py b/tests/integration/blockchain/test_network.py index e5cc725cc..b7f5a3bea 100644 --- a/tests/integration/blockchain/test_network.py +++ b/tests/integration/blockchain/test_network.py @@ -135,7 +135,7 @@ class ReconnectTests(IntegrationTestCase): await self.conductor.spv_node.stop() self.assertFalse(self.ledger.network.is_connected) await asyncio.sleep(0.2) # let it retry and fail once - await self.conductor.spv_node.start(self.conductor.blockchain_node) + await self.conductor.spv_node.start(self.conductor.lbcwallet_node) await self.ledger.network.on_connected.first self.assertTrue(self.ledger.network.is_connected) @@ -165,8 +165,10 @@ class UDPServerFailDiscoveryTest(AsyncioTestCase): async def test_wallet_connects_despite_lack_of_udp(self): conductor = Conductor() conductor.spv_node.udp_port = '0' - await conductor.start_blockchain() - self.addCleanup(conductor.stop_blockchain) + await conductor.start_lbcd() + self.addCleanup(conductor.stop_lbcd) + await conductor.start_lbcwallet() + self.addCleanup(conductor.stop_lbcwallet) await conductor.start_spv() self.addCleanup(conductor.stop_spv) self.assertFalse(conductor.spv_node.server.bp.status_server.is_running) diff --git a/tests/integration/blockchain/test_wallet_commands.py b/tests/integration/blockchain/test_wallet_commands.py index ab11d930d..f506f1a2c 100644 --- a/tests/integration/blockchain/test_wallet_commands.py +++ b/tests/integration/blockchain/test_wallet_commands.py @@ -49,7 +49,7 @@ class WalletCommands(CommandTestCase): self.assertEqual(status['wallet']['servers'][0]['port'], 50002) await self.conductor.spv_node.stop(True) self.conductor.spv_node.port = 54320 - await self.conductor.spv_node.start(self.conductor.blockchain_node) + await self.conductor.spv_node.start(self.conductor.lbcwallet_node) status = await self.daemon.jsonrpc_status() self.assertEqual(len(status['wallet']['servers']), 0) self.daemon.jsonrpc_settings_set('lbryum_servers', ['localhost:54320']) diff --git a/tests/integration/claims/test_claim_commands.py b/tests/integration/claims/test_claim_commands.py index b5aeefdd0..1221fc747 100644 --- a/tests/integration/claims/test_claim_commands.py +++ b/tests/integration/claims/test_claim_commands.py @@ -1555,7 +1555,7 @@ class StreamCommands(ClaimTestCase): ) # test setting from env vars and starting from scratch await self.conductor.spv_node.stop(False) - await self.conductor.spv_node.start(self.conductor.blockchain_node, + await self.conductor.spv_node.start(self.conductor.lbcwallet_node, extraconf={'BLOCKING_CHANNEL_IDS': blocking_channel_id, 'FILTERING_CHANNEL_IDS': filtering_channel_id}) await self.daemon.wallet_manager.reset() diff --git a/tests/integration/takeovers/test_resolve_command.py b/tests/integration/takeovers/test_resolve_command.py index 7856270ed..cfb6ff82b 100644 --- a/tests/integration/takeovers/test_resolve_command.py +++ b/tests/integration/takeovers/test_resolve_command.py @@ -273,7 +273,7 @@ class ResolveCommand(BaseResolveTestCase): # resolve retries await self.conductor.spv_node.stop() resolve_task = asyncio.create_task(self.resolve('foo')) - await self.conductor.spv_node.start(self.conductor.blockchain_node) + await self.conductor.spv_node.start(self.conductor.lbcwallet_node) self.assertIsNotNone((await resolve_task)['claim_id']) async def test_winning_by_effective_amount(self):