diff --git a/lbry/blockchain/lbrycrd.py b/lbry/blockchain/lbrycrd.py index 86dcda039..d0dcce91a 100644 --- a/lbry/blockchain/lbrycrd.py +++ b/lbry/blockchain/lbrycrd.py @@ -15,7 +15,7 @@ import zmq.asyncio from lbry.conf import Config from lbry.event import EventController -from lbry.error import LbrycrdEventSubscriptionError, LbrycrdUnauthorizedError, LbrycrdMisconfigurationError +from lbry.error import LbrycrdEventSubscriptionError, LbrycrdUnauthorizedError from .database import BlockchainDB from .ledger import Ledger, RegTestLedger @@ -209,8 +209,6 @@ class Lbrycrd: async def ensure_subscribable(self): zmq_notifications = await self.get_zmq_notifications() - if not zmq_notifications: - raise LbrycrdMisconfigurationError("zmqpubhashblock") subs = {e['type']: e['address'] for e in zmq_notifications} if ZMQ_BLOCK_EVENT not in subs: raise LbrycrdEventSubscriptionError(ZMQ_BLOCK_EVENT) diff --git a/lbry/blockchain/sync/synchronizer.py b/lbry/blockchain/sync/synchronizer.py index 5bdf3931e..cea8bf751 100644 --- a/lbry/blockchain/sync/synchronizer.py +++ b/lbry/blockchain/sync/synchronizer.py @@ -10,9 +10,9 @@ from lbry.db.query_context import Event, Progress from lbry.event import BroadcastSubscription from lbry.service.base import Sync, BlockEvent from lbry.blockchain.lbrycrd import Lbrycrd +from lbry.error import LbrycrdEventSubscriptionError from . import blocks as block_phase, claims as claim_phase, supports as support_phase -from ...error import LbrycrdMisconfigurationError log = logging.getLogger(__name__) @@ -49,8 +49,11 @@ class BlockchainSync(Sync): return await self.chain.ensure_subscribable() except asyncio.CancelledError: raise - except LbrycrdMisconfigurationError as e: - log.warning(str(e)) + except LbrycrdEventSubscriptionError as e: + log.warning( + "Lbrycrd is misconfigured. Please double check if" + " zmqpubhashblock is properly set on lbrycrd.conf" + ) raise except Exception as e: log.warning("Blockchain not ready, waiting for it: %s", str(e)) diff --git a/lbry/error/__init__.py b/lbry/error/__init__.py index cf0cee4c5..57086d852 100644 --- a/lbry/error/__init__.py +++ b/lbry/error/__init__.py @@ -417,10 +417,3 @@ class LbrycrdEventSubscriptionError(LbrycrdError): def __init__(self, event): self.event = event super().__init__(f"Lbrycrd is not publishing '{event}' events.") - - -class LbrycrdMisconfigurationError(LbrycrdError): - def __init__(self, config_key): - self.config_key = config_key - super().__init__(f"Lbrycrd is misconfigured. Please double check if" - f" {config_key} is properly set on lbrycrd.conf") diff --git a/tests/integration/blockchain/test_blockchain.py b/tests/integration/blockchain/test_blockchain.py index 9494015aa..f99836fd5 100644 --- a/tests/integration/blockchain/test_blockchain.py +++ b/tests/integration/blockchain/test_blockchain.py @@ -11,7 +11,7 @@ from lbry import Config, Database, RegTestLedger, Transaction, Output, Input from lbry.crypto.base58 import Base58 from lbry.schema.claim import Stream, Channel from lbry.schema.support import Support -from lbry.error import LbrycrdEventSubscriptionError, LbrycrdUnauthorizedError, LbrycrdMisconfigurationError +from lbry.error import LbrycrdEventSubscriptionError, LbrycrdUnauthorizedError from lbry.blockchain.lbrycrd import Lbrycrd from lbry.blockchain.sync import BlockchainSync from lbry.blockchain.dewies import dewies_to_lbc, lbc_to_dewies @@ -304,7 +304,7 @@ class TestLbrycrdAPIs(AsyncioTestCase): # lbrycrdr started without zmq await chain.start() - with self.assertRaises(LbrycrdMisconfigurationError): + with self.assertRaises(LbrycrdEventSubscriptionError): await chain.ensure_subscribable() await chain.stop() @@ -620,7 +620,7 @@ class TestGeneralBlockchainSync(SyncingBlockchainTestCase): await asyncio.sleep(0) self.chain.ledger.conf.set(lbrycrd_zmq_blocks='') await self.chain.start() - with self.assertRaises(LbrycrdMisconfigurationError): + with self.assertRaises(LbrycrdEventSubscriptionError): await asyncio.wait_for(sync_start, timeout=10) await self.chain.stop()