connector
This commit is contained in:
parent
c57919aacd
commit
fcc83e69da
@ -377,6 +377,8 @@ class Connector:
|
|||||||
await self.utxo.destroy_utxo()
|
await self.utxo.destroy_utxo()
|
||||||
try: self.checkpoints.append(block["checkpoint"])
|
try: self.checkpoints.append(block["checkpoint"])
|
||||||
except: pass
|
except: pass
|
||||||
|
if len(self.utxo.cached) > self.utxo.size_limit:
|
||||||
|
self.loop.create_task(self.utxo.save_utxo())
|
||||||
|
|
||||||
|
|
||||||
self.blocks_processed_count += 1
|
self.blocks_processed_count += 1
|
||||||
|
|||||||
@ -5,17 +5,15 @@ from collections import OrderedDict, deque as LRU
|
|||||||
from pybtc import LRU
|
from pybtc import LRU
|
||||||
|
|
||||||
class UTXO():
|
class UTXO():
|
||||||
def __init__(self, db_pool, loop, log, cache_size, block_txo_max = 500000):
|
def __init__(self, db_pool, loop, log, cache_size):
|
||||||
self.cached = LRU(cache_size)
|
self.cached = LRU()
|
||||||
self.missed = set()
|
self.missed = set()
|
||||||
self.destroyed = deque()
|
self.destroyed = deque()
|
||||||
self.deleted = LRU(200000)
|
self.deleted = LRU()
|
||||||
self.log = log
|
self.log = log
|
||||||
self.loaded = OrderedDict()
|
self.loaded = OrderedDict()
|
||||||
self.maturity = 100
|
self.maturity = 100
|
||||||
self.block_txo_max = block_txo_max
|
self.size_limit = cache_size
|
||||||
self._cache_hard_limit = cache_size - block_txo_max
|
|
||||||
self._cache_soft_limit = cache_size - block_txo_max * 2
|
|
||||||
self._db_pool = db_pool
|
self._db_pool = db_pool
|
||||||
self.loop = loop
|
self.loop = loop
|
||||||
self.clear_tail = False
|
self.clear_tail = False
|
||||||
@ -60,6 +58,8 @@ class UTXO():
|
|||||||
|
|
||||||
async def save_utxo(self):
|
async def save_utxo(self):
|
||||||
# save to db tail from cache
|
# save to db tail from cache
|
||||||
|
self.log.critical("save utxo>>>>")
|
||||||
|
return
|
||||||
if not self.save_future.done():
|
if not self.save_future.done():
|
||||||
await self.save_future.done()
|
await self.save_future.done()
|
||||||
return
|
return
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user