logging, update lbry-rocksdb requirement
This commit is contained in:
parent
3c7307a2f4
commit
607d7d9cc7
5 changed files with 10 additions and 22 deletions
|
@ -10,7 +10,8 @@ from lbry.wallet.wallet import Wallet, WalletStorage, TimestampedPreferences, EN
|
|||
from lbry.wallet.manager import WalletManager
|
||||
from lbry.wallet.network import Network
|
||||
from lbry.wallet.ledger import Ledger, RegTestLedger, TestNetLedger, BlockHeightEvent
|
||||
from lbry.wallet.account import Account, AddressManager, SingleKey, HierarchicalDeterministic
|
||||
from lbry.wallet.account import Account, AddressManager, SingleKey, HierarchicalDeterministic, \
|
||||
DeterministicChannelKeyManager
|
||||
from lbry.wallet.transaction import Transaction, Output, Input
|
||||
from lbry.wallet.script import OutputScript, InputScript
|
||||
from lbry.wallet.database import SQLiteMixin, Database
|
||||
|
|
|
@ -41,14 +41,14 @@ class BlockchainReader:
|
|||
return
|
||||
# if state and self.last_state and self.db.headers and self.last_state.tip == self.db.coin.header_hash(self.db.headers[-1]):
|
||||
# return
|
||||
if self.last_state and self.last_state.height > state.height: # FIXME: derp
|
||||
self.log.debug("reorg detected, waiting until the writer has flushed the new blocks to advance")
|
||||
if self.last_state and self.last_state.height > state.height:
|
||||
self.log.warning("reorg detected, waiting until the writer has flushed the new blocks to advance")
|
||||
return
|
||||
last_height = 0 if not self.last_state else self.last_state.height
|
||||
if self.last_state:
|
||||
while True:
|
||||
if self.db.headers[-1] == self.db.prefix_db.header.get(last_height, deserialize_value=False):
|
||||
self.log.debug("connects to block %i", last_height)
|
||||
self.log.info("connects to block %i", last_height)
|
||||
break
|
||||
else:
|
||||
self.log.warning("disconnect block %i", last_height)
|
||||
|
@ -62,22 +62,10 @@ class BlockchainReader:
|
|||
self.clear_caches()
|
||||
self.last_state = state
|
||||
|
||||
# elif self.last_state and self.last_state.height > state.height:
|
||||
# last_height = self.last_state.height
|
||||
# for height in range(last_height, state.height, -1):
|
||||
# self.log.warning("unwind %i", height)
|
||||
# self.unwind()
|
||||
# self.clear_caches()
|
||||
# self.last_state = state
|
||||
# self.log.warning("unwound to %i", self.last_state.height)
|
||||
|
||||
# print("reader rewound to ", self.last_state.height)
|
||||
|
||||
async def poll_for_changes(self):
|
||||
await asyncio.get_event_loop().run_in_executor(self._executor, self._detect_changes)
|
||||
|
||||
async def refresh_blocks_forever(self, synchronized: asyncio.Event):
|
||||
self.log.info("start refresh blocks forever")
|
||||
while True:
|
||||
try:
|
||||
async with self._lock:
|
||||
|
@ -85,7 +73,7 @@ class BlockchainReader:
|
|||
except asyncio.CancelledError:
|
||||
raise
|
||||
except:
|
||||
self.log.exception("boom")
|
||||
self.log.exception("blockchain reader main loop encountered an unexpected error")
|
||||
raise
|
||||
await asyncio.sleep(self._refresh_interval)
|
||||
synchronized.set()
|
||||
|
@ -161,7 +149,6 @@ class BlockchainReaderServer(BlockchainReader):
|
|||
self.log.info("reader advanced to %i", height)
|
||||
if self._es_height == self.db.db_height:
|
||||
self.synchronized.set()
|
||||
# print("reader notified")
|
||||
await self.mempool.refresh_hashes(self.db.db_height)
|
||||
self.notifications_to_send.clear()
|
||||
|
||||
|
|
|
@ -804,7 +804,7 @@ class HubDB:
|
|||
return int(160.6855883050695 * height)
|
||||
|
||||
def open_db(self):
|
||||
if self.prefix_db and not self.prefix_db.closed:
|
||||
if self.prefix_db:
|
||||
return
|
||||
secondary_path = '' if not self._secondary_name else os.path.join(
|
||||
self._db_dir, self._secondary_name
|
||||
|
@ -857,6 +857,7 @@ class HubDB:
|
|||
|
||||
def close(self):
|
||||
self.prefix_db.close()
|
||||
self.prefix_db = None
|
||||
|
||||
def get_tx_hash(self, tx_num: int) -> bytes:
|
||||
if self._cache_all_tx_hashes:
|
||||
|
|
|
@ -125,8 +125,7 @@ class PrefixDB:
|
|||
)
|
||||
|
||||
def close(self):
|
||||
if not self._db.is_closed:
|
||||
self._db.close()
|
||||
self._db.close()
|
||||
|
||||
def try_catch_up_with_primary(self):
|
||||
self._db.try_catch_up_with_primary()
|
||||
|
|
2
setup.py
2
setup.py
|
@ -10,7 +10,7 @@ with open(os.path.join(BASE, 'README.md'), encoding='utf-8') as fh:
|
|||
|
||||
ROCKSDB = []
|
||||
if sys.platform.startswith('linux') or sys.platform.startswith('darwin'):
|
||||
ROCKSDB.append('lbry-rocksdb==0.8.1')
|
||||
ROCKSDB.append('lbry-rocksdb==0.8.2')
|
||||
|
||||
|
||||
setup(
|
||||
|
|
Loading…
Reference in a new issue