connector

This commit is contained in:
4tochka 2019-05-13 17:52:21 +04:00
parent 098e2580fe
commit 1cc5ce9813

View File

@ -65,10 +65,11 @@ class UTXO():
checkpoint = self.checkpoints.popleft() checkpoint = self.checkpoints.popleft()
else: else:
checkpoint_found = True checkpoint_found = True
elif checkpoint < lb - 1 and self.checkpoints: while self.checkpoints and checkpoint < lb - 1:
checkpoint = self.checkpoints.popleft() checkpoint = self.checkpoints.popleft()
if len(self.cached) <= self.size_limit: if len(self.cached) <= self.size_limit:
if block_changed and checkpoint_found: if block_changed and checkpoint_found:
break break
@ -186,14 +187,14 @@ class UTXO():
continue continue
break break
try: try:
self.log.critical("load utxo " + str(self.missed))
self.load_utxo_future = asyncio.Future() self.load_utxo_future = asyncio.Future()
l = set(self.missed) l = set(self.missed)
async with self._db_pool.acquire() as conn: async with self._db_pool.acquire() as conn:
rows = await conn.fetch("SELECT outpoint, connector_utxo.data " rows = await conn.fetch("SELECT outpoint, connector_utxo.data "
"FROM connector_utxo " "FROM connector_utxo "
"WHERE outpoint = ANY($1);", l) "WHERE outpoint = ANY($1);", l)
self.log.critical("-"+str(len(self.missed))) self.log.critical("loaded "+str(len(self.missed)))
for i in l: for i in l:
try: try:
self.missed.remove(i) self.missed.remove(i)