Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
review changes
Browse files Browse the repository at this point in the history
glevco committed Mar 20, 2024

Verified

This commit was signed with the committer’s verified signature.
snyk-bot Snyk bot
1 parent da846f4 commit 20d492d
Showing 5 changed files with 10 additions and 10 deletions.
7 changes: 3 additions & 4 deletions hathor/builder/builder.py
Original file line number Diff line number Diff line change
@@ -46,7 +46,6 @@
TransactionRocksDBStorage,
TransactionStorage,
)
from hathor.transaction.storage.transaction_storage import BaseTransactionStorage
from hathor.util import Random, get_environment_info, not_none
from hathor.verification.verification_service import VerificationService
from hathor.verification.vertex_verifiers import VertexVerifiers
@@ -132,7 +131,7 @@ def __init__(self) -> None:
self._tx_storage_cache_capacity: Optional[int] = None

self._indexes_manager: Optional[IndexesManager] = None
self._tx_storage: Optional[BaseTransactionStorage] = None
self._tx_storage: Optional[TransactionStorage] = None
self._event_storage: Optional[EventStorage] = None

self._reactor: Optional[Reactor] = None
@@ -394,7 +393,7 @@ def _get_or_create_indexes_manager(self) -> IndexesManager:

return self._indexes_manager

def _get_or_create_tx_storage(self) -> BaseTransactionStorage:
def _get_or_create_tx_storage(self) -> TransactionStorage:
indexes = self._get_or_create_indexes_manager()

if self._tx_storage is not None:
@@ -617,7 +616,7 @@ def enable_event_queue(self) -> 'Builder':
self._enable_event_queue = True
return self

def set_tx_storage(self, tx_storage: BaseTransactionStorage) -> 'Builder':
def set_tx_storage(self, tx_storage: TransactionStorage) -> 'Builder':
self.check_if_can_modify()
self._tx_storage = tx_storage
return self
4 changes: 2 additions & 2 deletions hathor/manager.py
Original file line number Diff line number Diff line change
@@ -58,7 +58,7 @@
from hathor.transaction import BaseTransaction, Block, MergeMinedBlock, Transaction, TxVersion, sum_weights
from hathor.transaction.exceptions import TxValidationError
from hathor.transaction.storage.exceptions import TransactionDoesNotExist
from hathor.transaction.storage.transaction_storage import BaseTransactionStorage
from hathor.transaction.storage.transaction_storage import TransactionStorage
from hathor.transaction.storage.tx_allow_scope import TxAllowScope
from hathor.types import Address, VertexId
from hathor.util import EnvironmentInfo, LogDuration, Random, calculate_min_significant_weight, not_none
@@ -97,7 +97,7 @@ def __init__(self,
consensus_algorithm: ConsensusAlgorithm,
daa: DifficultyAdjustmentAlgorithm,
peer_id: PeerId,
tx_storage: BaseTransactionStorage,
tx_storage: TransactionStorage,
p2p_manager: ConnectionsManager,
event_manager: EventManager,
feature_service: FeatureService,
1 change: 1 addition & 0 deletions hathor/transaction/storage/transaction_storage.py
Original file line number Diff line number Diff line change
@@ -73,6 +73,7 @@ class TransactionStorage(ABC):

pubsub: Optional[PubSubManager]
indexes: Optional[IndexesManager]
_latest_n_height_tips: list[HeightInfo]

log = get_logger()

4 changes: 2 additions & 2 deletions tests/p2p/test_sync_v2.py
Original file line number Diff line number Diff line change
@@ -19,7 +19,7 @@
Trigger,
)
from hathor.transaction.storage import TransactionRocksDBStorage
from hathor.transaction.storage.transaction_storage import BaseTransactionStorage
from hathor.transaction.storage.transaction_storage import TransactionStorage
from hathor.transaction.storage.traversal import DFSWalk
from hathor.types import VertexId
from hathor.util import not_none
@@ -32,7 +32,7 @@ class BaseRandomSimulatorTestCase(SimulatorTestCase):

seed_config = 2

def _get_partial_blocks(self, tx_storage: BaseTransactionStorage) -> set[VertexId]:
def _get_partial_blocks(self, tx_storage: TransactionStorage) -> set[VertexId]:
with tx_storage.allow_partially_validated_context():
partial_blocks = set()
for tx in tx_storage.get_all_transactions():
4 changes: 2 additions & 2 deletions tests/unittest.py
Original file line number Diff line number Diff line change
@@ -22,7 +22,7 @@
from hathor.reactor import ReactorProtocol as Reactor, get_global_reactor
from hathor.simulator.clock import MemoryReactorHeapClock
from hathor.transaction import BaseTransaction
from hathor.transaction.storage.transaction_storage import BaseTransactionStorage
from hathor.transaction.storage.transaction_storage import TransactionStorage
from hathor.util import Random, not_none
from hathor.wallet import BaseWallet, HDWallet, Wallet
from tests.test_memory_reactor_clock import TestMemoryReactorClock
@@ -190,7 +190,7 @@ def create_peer( # type: ignore[no-untyped-def]
network: str,
peer_id: PeerId | None = None,
wallet: BaseWallet | None = None,
tx_storage: BaseTransactionStorage | None = None,
tx_storage: TransactionStorage | None = None,
unlock_wallet: bool = True,
wallet_index: bool = False,
capabilities: list[str] | None = None,

0 comments on commit 20d492d

Please sign in to comment.