Skip to content

Commit

Permalink
fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
jackrobison committed Dec 4, 2020
1 parent d02ff23 commit 2fa2c87
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 3 deletions.
2 changes: 2 additions & 0 deletions lbry/testcase.py
Original file line number Diff line number Diff line change
Expand Up @@ -340,6 +340,7 @@ async def asyncSetUp(self):
server_tmp_dir = tempfile.mkdtemp()
self.addCleanup(shutil.rmtree, server_tmp_dir)
self.server_config = Config()
self.server_config.transaction_cache_size = 10000
self.server_storage = SQLiteStorage(self.server_config, ':memory:')
await self.server_storage.open()

Expand Down Expand Up @@ -389,6 +390,7 @@ async def add_daemon(self, wallet_node=None, seed=None):
conf.fixed_peers = [('127.0.0.1', 5567)]
conf.known_dht_nodes = []
conf.blob_lru_cache_size = self.blob_lru_cache_size
conf.transaction_cache_size = 10000
conf.components_to_skip = [
DHT_COMPONENT, UPNP_COMPONENT, HASH_ANNOUNCER_COMPONENT,
PEER_PROTOCOL_SERVER_COMPONENT
Expand Down
4 changes: 2 additions & 2 deletions lbry/wallet/ledger.py
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ def __init__(self, config=None):
self._on_ready_controller = StreamController()
self.on_ready = self._on_ready_controller.stream

self._tx_cache = pylru.lrucache(self.config.get("tx_cache_size", 10_000_000))
self._tx_cache = pylru.lrucache(self.config.get("tx_cache_size", 10_000))
self._update_tasks = TaskGroup()
self._other_tasks = TaskGroup() # that we dont need to start
self._utxo_reservation_lock = asyncio.Lock()
Expand Down Expand Up @@ -578,7 +578,7 @@ async def update_history(self, address, remote_status, address_manager: AddressM
log.warning("history mismatch: %s vs %s", remote_history[remote_i], pending_synced_history[i])
synced_history += pending_synced_history[i]

cache_size = self.config.get("tx_cache_size", 10_000_000)
cache_size = self.config.get("tx_cache_size", 10_000)
for txid, cache_item in updated_cached_items.items():
cache_item.pending_verifications -= 1
if cache_item.pending_verifications < 0:
Expand Down
2 changes: 2 additions & 0 deletions tests/unit/blob_exchange/test_transfer_blob.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,14 @@ async def asyncSetUp(self):
self.addCleanup(shutil.rmtree, self.server_dir)
self.server_config = Config(data_dir=self.server_dir, download_dir=self.server_dir, wallet=self.server_dir,
fixed_peers=[])
self.server_config.transaction_cache_size = 10000
self.server_storage = SQLiteStorage(self.server_config, os.path.join(self.server_dir, "lbrynet.sqlite"))
self.server_blob_manager = BlobManager(self.loop, self.server_dir, self.server_storage, self.server_config)
self.server = BlobServer(self.loop, self.server_blob_manager, 'bQEaw42GXsgCAGio1nxFncJSyRmnztSCjP')

self.client_config = Config(data_dir=self.client_dir, download_dir=self.client_dir,
wallet=self.client_wallet_dir, fixed_peers=[])
self.client_config.transaction_cache_size = 10000
self.client_storage = SQLiteStorage(self.client_config, os.path.join(self.client_dir, "lbrynet.sqlite"))
self.client_blob_manager = BlobManager(self.loop, self.client_dir, self.client_storage, self.client_config)
self.client_peer_manager = PeerManager(self.loop)
Expand Down
4 changes: 3 additions & 1 deletion tests/unit/stream/test_stream_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,12 +98,14 @@ def __getitem__(self, item):
wallet = Wallet()
ledger = Ledger({
'db': Database(os.path.join(wallet_dir, 'blockchain.db')),
'headers': FakeHeaders(514082)
'headers': FakeHeaders(514082),
'tx_cache_size': 10000
})
await ledger.db.open()
wallet.generate_account(ledger)
manager = WalletManager()
manager.config = Config()
manager.config.transaction_cache_size = 10000
manager.wallets.append(wallet)
manager.ledgers[Ledger] = ledger
manager.ledger.network.client = ClientSession(
Expand Down

0 comments on commit 2fa2c87

Please sign in to comment.