connector

This commit is contained in:
4tochka 2019-05-29 16:39:55 +04:00
parent b3d937dd62
commit c5e67bee65
2 changed files with 7 additions and 6 deletions

View File

@ -16,7 +16,7 @@ from pybtc import MRU
class BlockLoader: class BlockLoader:
def __init__(self, parent, workers=8): def __init__(self, parent, workers=6):
self.worker_limit = workers self.worker_limit = workers
self.worker = dict() self.worker = dict()
self.worker_tasks = list() self.worker_tasks = list()
@ -187,7 +187,8 @@ class BlockLoader:
for i in blocks: for i in blocks:
self.parent.block_preload.set(i, blocks[i]) self.parent.block_preload.set(i, blocks[i])
if blocks: if blocks:
self.parent.utxo.checkpoints.append(i) if self.parent.utxo.checkpoints[-1] < i:
self.parent.utxo.checkpoints.append(i)
# def disconnect(self,ip): # def disconnect(self,ip):
@ -218,9 +219,9 @@ class Worker:
self.loop.set_default_executor(ThreadPoolExecutor(20)) self.loop.set_default_executor(ThreadPoolExecutor(20))
self.out_writer = out_writer self.out_writer = out_writer
self.in_reader = in_reader self.in_reader = in_reader
self.coins = MRU(100000) self.coins = MRU(1000000)
self.destroyed_coins = MRU(100000) self.destroyed_coins = MRU(1000000)
self.a_coins = MRU(100000) self.a_coins = MRU(1000000)
signal.signal(signal.SIGTERM, self.terminate) signal.signal(signal.SIGTERM, self.terminate)
self.loop.create_task(self.message_loop()) self.loop.create_task(self.message_loop())
self.loop.run_forever() self.loop.run_forever()

View File

@ -453,7 +453,7 @@ class Connector:
self.utxo.deleted_utxo, self.utxo.deleted_utxo,
self.utxo.loaded_utxo self.utxo.loaded_utxo
)) ))
self.log.debug("Preload coins chached/destoyed -> %s-%s [%s];" % (self.yy, self.aa, self.tt)) self.log.debug("Preload coins cached/destoyed -> %s-%s [%s];" % (self.yy, self.aa, self.tt))
self.log.debug("Coins %s; destroyed %s; unspent %s;" % (self.coins, self.log.debug("Coins %s; destroyed %s; unspent %s;" % (self.coins,
self.destroyed_coins, self.destroyed_coins,
self.coins - self.destroyed_coins)) self.coins - self.destroyed_coins))