From d16bf99fdad9a2e99783f5691d4380b77a143c22 Mon Sep 17 00:00:00 2001 From: 4tochka Date: Mon, 3 Jun 2019 11:06:43 +0400 Subject: [PATCH] connector --- pybtc/connector/utxo.py | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/pybtc/connector/utxo.py b/pybtc/connector/utxo.py index a8efc02..2574d5a 100644 --- a/pybtc/connector/utxo.py +++ b/pybtc/connector/utxo.py @@ -77,14 +77,13 @@ class UTXO(): block_changed = True lb = i[1][0] >> 39 if lb - 1 == checkpoint: - if len(self.pending_utxo) < int(self.size_limit * 0.9): - if len(self.cached) > int(self.size_limit * 0.9): - if self.checkpoints: - checkpoint = self.checkpoints.pop(0) - else: - if len(self.cached) > int(self.size_limit): - if self.checkpoints: - checkpoint = self.checkpoints.pop(0) + if len(self.pending_utxo) > self.size_limit * 0.9: + limit = self.size_limit + else: + limit = self.size_limit * 0.9 + if len(self.cached) > limit: + if self.checkpoints: + checkpoint = self.checkpoints.pop(0) else: checkpoint_found = True while self.checkpoints and checkpoint < lb - 1: