Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions hathor/p2p/manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,8 +98,8 @@ def __init__(self,
enable_sync_v1: bool,
enable_sync_v2: bool,
enable_sync_v1_1: bool) -> None:
from hathor.p2p.sync_v1_1_factory import SyncV11Factory
from hathor.p2p.sync_v1_factory import SyncV1Factory
from hathor.p2p.sync_v1.factory_v1_0 import SyncV10Factory
from hathor.p2p.sync_v1.factory_v1_1 import SyncV11Factory

if not (enable_sync_v1 or enable_sync_v1_1 or enable_sync_v2):
raise TypeError(f'{type(self).__name__}() at least one sync version is required')
Expand Down Expand Up @@ -181,11 +181,11 @@ def __init__(self,
# sync-manager factories
self._sync_factories = {}
if enable_sync_v1:
self._sync_factories[SyncVersion.V1] = SyncV1Factory(self)
self._sync_factories[SyncVersion.V1] = SyncV10Factory(self)
if enable_sync_v1_1:
self._sync_factories[SyncVersion.V1_1] = SyncV11Factory(self)
if enable_sync_v2:
self._sync_factories[SyncVersion.V2] = SyncV1Factory(self)
self._sync_factories[SyncVersion.V2] = SyncV10Factory(self)

def set_manager(self, manager: 'HathorManager') -> None:
"""Set the manager. This method must be called before start()."""
Expand Down
Empty file.
2 changes: 1 addition & 1 deletion hathor/p2p/node_sync.py → hathor/p2p/sync_v1/agent.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@
from zope.interface import implementer

from hathor.conf import HathorSettings
from hathor.p2p.downloader import Downloader
from hathor.p2p.messages import GetNextPayload, GetTipsPayload, NextPayload, ProtocolMessages, TipsPayload
from hathor.p2p.sync_manager import SyncManager
from hathor.p2p.sync_v1.downloader import Downloader
from hathor.transaction import BaseTransaction
from hathor.transaction.base_transaction import tx_or_block_from_bytes
from hathor.transaction.storage.exceptions import TransactionDoesNotExist
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@

if TYPE_CHECKING:
from hathor.manager import HathorManager
from hathor.p2p.node_sync import NodeSyncTimestamp
from hathor.p2p.sync_v1.agent import NodeSyncTimestamp
from hathor.transaction import BaseTransaction

logger = get_logger()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,18 +14,18 @@

from typing import TYPE_CHECKING, Optional

from hathor.p2p.downloader import Downloader
from hathor.p2p.manager import ConnectionsManager
from hathor.p2p.node_sync import NodeSyncTimestamp
from hathor.p2p.sync_factory import SyncManagerFactory
from hathor.p2p.sync_manager import SyncManager
from hathor.p2p.sync_v1.agent import NodeSyncTimestamp
from hathor.p2p.sync_v1.downloader import Downloader
from hathor.util import Reactor

if TYPE_CHECKING:
from hathor.p2p.protocol import HathorProtocol


class SyncV1Factory(SyncManagerFactory):
class SyncV10Factory(SyncManagerFactory):
def __init__(self, connections: ConnectionsManager):
self.connections = connections
self._downloader: Optional[Downloader] = None
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@

from typing import TYPE_CHECKING, Optional

from hathor.p2p.downloader import Downloader
from hathor.p2p.manager import ConnectionsManager
from hathor.p2p.node_sync import NodeSyncTimestamp
from hathor.p2p.sync_factory import SyncManagerFactory
from hathor.p2p.sync_manager import SyncManager
from hathor.p2p.sync_v1.agent import NodeSyncTimestamp
from hathor.p2p.sync_v1.downloader import Downloader
from hathor.util import Reactor

if TYPE_CHECKING:
Expand Down
2 changes: 1 addition & 1 deletion tests/p2p/test_sync.py
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,7 @@ class SyncV1HathorSyncMethodsTestCase(unittest.SyncV1Params, BaseHathorSyncMetho
__test__ = True

def test_downloader(self):
from hathor.p2p.node_sync import NodeSyncTimestamp
from hathor.p2p.sync_v1.agent import NodeSyncTimestamp

blocks = self._add_new_blocks(3)

Expand Down