connector
This commit is contained in:
parent
8ea3a02a29
commit
709a785a42
@ -751,14 +751,19 @@ class UTXO():
|
|||||||
c = len(self.cached) - self._cache_size
|
c = len(self.cached) - self._cache_size
|
||||||
if block_height > 0 and not self.save_process and c > 0:
|
if block_height > 0 and not self.save_process and c > 0:
|
||||||
try:
|
try:
|
||||||
|
self.save_process = True
|
||||||
lb = 0
|
lb = 0
|
||||||
|
ln, rs = set(), set()
|
||||||
|
r = set()
|
||||||
|
db = set()
|
||||||
for key in iter(self.cached):
|
for key in iter(self.cached):
|
||||||
i = self.cached[key]
|
i = self.cached[key]
|
||||||
if (c>0 or lb == i[0] >> 42) and (i[0] >> 42) < block_height:
|
if (c>0 or lb == i[0] >> 42) and (i[0] >> 42) < block_height:
|
||||||
c -= 1
|
c -= 1
|
||||||
continue
|
continue
|
||||||
break
|
break
|
||||||
self.save_process = True
|
if lb:
|
||||||
|
|
||||||
for key in self.destroyed:
|
for key in self.destroyed:
|
||||||
if key < lb:
|
if key < lb:
|
||||||
n = set()
|
n = set()
|
||||||
@ -776,7 +781,7 @@ class UTXO():
|
|||||||
self.log.critical(str(key))
|
self.log.critical(str(key))
|
||||||
|
|
||||||
|
|
||||||
ln, rs = set(), set()
|
|
||||||
for key in iter(self.cached):
|
for key in iter(self.cached):
|
||||||
i = self.cached[key]
|
i = self.cached[key]
|
||||||
if i[0] >> 42 <= lb:
|
if i[0] >> 42 <= lb:
|
||||||
@ -792,8 +797,7 @@ class UTXO():
|
|||||||
# await asyncio.sleep(0)
|
# await asyncio.sleep(0)
|
||||||
# return
|
# return
|
||||||
|
|
||||||
r = set()
|
|
||||||
db = set()
|
|
||||||
for key in iter(self.destroyed):
|
for key in iter(self.destroyed):
|
||||||
if key <= lb and key < block_height:
|
if key <= lb and key < block_height:
|
||||||
db.add(key)
|
db.add(key)
|
||||||
@ -814,6 +818,8 @@ class UTXO():
|
|||||||
"WHERE name = 'last_cached_block';", block_height)
|
"WHERE name = 'last_cached_block';", block_height)
|
||||||
self.saved_utxo += len(rs)
|
self.saved_utxo += len(rs)
|
||||||
self.deleted_utxo += len(r)
|
self.deleted_utxo += len(r)
|
||||||
|
|
||||||
|
if lb:
|
||||||
# remove from cache
|
# remove from cache
|
||||||
for key in ln:
|
for key in ln:
|
||||||
try:
|
try:
|
||||||
@ -823,7 +829,6 @@ class UTXO():
|
|||||||
for key in self.destroyed:
|
for key in self.destroyed:
|
||||||
if not self.destroyed[key]:
|
if not self.destroyed[key]:
|
||||||
self.destroyed.pop(key)
|
self.destroyed.pop(key)
|
||||||
if lb:
|
|
||||||
self.last_saved_block = lb
|
self.last_saved_block = lb
|
||||||
finally:
|
finally:
|
||||||
self.save_process = False
|
self.save_process = False
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user