connector

This commit is contained in:
4tochka 2019-05-08 13:36:22 +04:00
parent 20d4eca5bd
commit 556e47ce94
2 changed files with 19 additions and 5 deletions

View File

@ -377,11 +377,11 @@ class Connector:
self.block_headers_cache.set(block["hash"], block["height"]) self.block_headers_cache.set(block["hash"], block["height"])
self.last_block_height = block["height"] self.last_block_height = block["height"]
# if self.utxo_data: if self.utxo_data:
# if not self.deep_synchronization: if not self.deep_synchronization:
# self.utxo.destroy_utxo(block["height"]) self.utxo.destroy_utxo(block["height"])
# elif block["height"] % 500 == 0: elif block["height"] % 500 == 0:
# self.utxo.destroy_utxo(block["height"]) self.utxo.destroy_utxo(block["height"])
self.blocks_processed_count += 1 self.blocks_processed_count += 1

View File

@ -43,6 +43,20 @@ class UTXO():
del self.cached[outpoint] del self.cached[outpoint]
def destroy_utxo(self, block_height): def destroy_utxo(self, block_height):
for outpoint in self.destroyed:
try:
del self.cached[outpoint]
self.destroyed_utxo += 1
except:
try:
del self.loaded[outpoint]
self.destroyed_utxo += 1
except:
self.destroyed_utxo += 1
pass
return
block_height -= self.maturity block_height -= self.maturity
for key in range(self.destroyed_utxo_block + 1, block_height + 1): for key in range(self.destroyed_utxo_block + 1, block_height + 1):
if key not in self.destroyed: continue if key not in self.destroyed: continue