Merge branch 'master' into isolate-config

This commit is contained in:
Sergi Delgado Segura
2020-01-15 10:15:48 +01:00
committed by GitHub
7 changed files with 380 additions and 136 deletions

View File

@@ -3,7 +3,7 @@ from queue import Queue
from threading import Thread
from common.cryptographer import Cryptographer
from common.constants import LOCATOR_LEN_HEX
from common.tools import compute_locator
from common.logger import Logger
from pisa.cleaner import Cleaner
@@ -70,20 +70,6 @@ class Watcher:
if not isinstance(responder, Responder):
self.responder = Responder(db_manager, self.config)
@staticmethod
def compute_locator(tx_id):
"""
Computes an appointment locator given a transaction id.
Args:
tx_id (:obj:`str`): the transaction id used to compute the locator.
Returns:
(:obj:`str`): The computed locator.
"""
return tx_id[:LOCATOR_LEN_HEX]
def add_appointment(self, appointment):
"""
Adds a new appointment to the ``appointments`` dictionary if ``max_appointments`` has not been reached.
@@ -237,7 +223,7 @@ class Watcher:
found.
"""
potential_locators = {Watcher.compute_locator(txid): txid for txid in txids}
potential_locators = {compute_locator(txid): txid for txid in txids}
# Check is any of the tx_ids in the received block is an actual match
intersection = set(self.locator_uuid_map.keys()).intersection(potential_locators.keys())