Skip to content

feat(sync-v2): Implement new protocol for synchronizing transactions #850

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Nov 8, 2023
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
195 changes: 0 additions & 195 deletions hathor/indexes/deps_index.py

This file was deleted.

31 changes: 0 additions & 31 deletions hathor/indexes/manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@

from hathor.indexes.address_index import AddressIndex
from hathor.indexes.base_index import BaseIndex
from hathor.indexes.deps_index import DepsIndex
from hathor.indexes.height_index import HeightIndex
from hathor.indexes.info_index import InfoIndex
from hathor.indexes.mempool_tips_index import MempoolTipsIndex
Expand Down Expand Up @@ -61,7 +60,6 @@ class IndexesManager(ABC):
sorted_txs: TimestampIndex

height: HeightIndex
deps: Optional[DepsIndex]
mempool_tips: Optional[MempoolTipsIndex]
addresses: Optional[AddressIndex]
tokens: Optional[TokensIndex]
Expand Down Expand Up @@ -90,7 +88,6 @@ def iter_all_indexes(self) -> Iterator[BaseIndex]:
self.sorted_blocks,
self.sorted_txs,
self.height,
self.deps,
self.mempool_tips,
self.addresses,
self.tokens,
Expand All @@ -112,11 +109,6 @@ def enable_utxo_index(self) -> None:
"""Enable UTXO index. It does nothing if it has already been enabled."""
raise NotImplementedError

@abstractmethod
def enable_deps_index(self) -> None:
"""Enable dependencies index. It does nothing if it has already been enabled."""
raise NotImplementedError

@abstractmethod
def enable_mempool_index(self) -> None:
"""Enable mempool index. It does nothing if it has already been enabled."""
Expand Down Expand Up @@ -194,8 +186,6 @@ def update(self, tx: BaseTransaction) -> None:
"""
# XXX: this _should_ be here, but it breaks some tests, for now this is done explicitly in hathor.manager
# self.mempool_tips.update(tx)
if self.deps:
self.deps.update(tx)
if self.utxo:
self.utxo.update(tx)

Expand Down Expand Up @@ -226,10 +216,6 @@ def add_tx(self, tx: BaseTransaction) -> bool:
if self.tokens:
self.tokens.add_tx(tx)

# XXX: this method is idempotent and has no result
if self.deps:
self.deps.add_tx(tx)

# We need to check r1 as well to make sure we don't count twice the transactions/blocks that are
# just changing from voided to executed or vice-versa
if r1 and r3:
Expand Down Expand Up @@ -272,10 +258,6 @@ def del_tx(self, tx: BaseTransaction, *, remove_all: bool = False, relax_assert:
if self.tokens:
self.tokens.del_tx(tx)

# XXX: this method is idempotent and has no result
if self.deps:
self.deps.del_tx(tx)


class MemoryIndexesManager(IndexesManager):
def __init__(self) -> None:
Expand All @@ -298,7 +280,6 @@ def __init__(self) -> None:
self.utxo = None
self.height = MemoryHeightIndex()
self.mempool_tips = None
self.deps = None

# XXX: this has to be at the end of __init__, after everything has been initialized
self.__init_checks__()
Expand All @@ -323,11 +304,6 @@ def enable_mempool_index(self) -> None:
if self.mempool_tips is None:
self.mempool_tips = MemoryMempoolTipsIndex()

def enable_deps_index(self) -> None:
from hathor.indexes.memory_deps_index import MemoryDepsIndex
if self.deps is None:
self.deps = MemoryDepsIndex()


class RocksDBIndexesManager(IndexesManager):
def __init__(self, rocksdb_storage: 'RocksDBStorage') -> None:
Expand All @@ -352,7 +328,6 @@ def __init__(self, rocksdb_storage: 'RocksDBStorage') -> None:
self.tokens = None
self.utxo = None
self.mempool_tips = None
self.deps = None

# XXX: this has to be at the end of __init__, after everything has been initialized
self.__init_checks__()
Expand All @@ -377,9 +352,3 @@ def enable_mempool_index(self) -> None:
if self.mempool_tips is None:
# XXX: use of RocksDBMempoolTipsIndex is very slow and was suspended
self.mempool_tips = MemoryMempoolTipsIndex()

def enable_deps_index(self) -> None:
from hathor.indexes.memory_deps_index import MemoryDepsIndex
if self.deps is None:
# XXX: use of RocksDBDepsIndex is currently suspended until it is fixed
self.deps = MemoryDepsIndex()
Loading