Adds Cleaner tests. Fixes Cleaner, Watcher and Responder

There is no need to return the dictionaries modified by the client since they are "passed-by-reference" in Python.
This commit is contained in:
Sergi Delgado Segura
2019-10-04 17:23:45 +01:00
parent 37c24dfb37
commit 1e18630ce2
4 changed files with 105 additions and 20 deletions

View File

@@ -120,8 +120,7 @@ class Responder:
txs, self.unconfirmed_txs, self.tx_job_map, self.missed_confirmations)
txs_to_rebroadcast = self.get_txs_to_rebroadcast(txs)
self.jobs, self.tx_job_map = Cleaner.delete_completed_jobs(self.jobs, self.tx_job_map,
self.get_completed_jobs(height), height)
Cleaner.delete_completed_jobs(self.jobs, self.tx_job_map, self.get_completed_jobs(height), height)
self.rebroadcast(txs_to_rebroadcast)
@@ -157,9 +156,10 @@ class Responder:
tx = Carrier.get_transaction(job.dispute_txid)
# FIXME: Should be improved with the librarian
if tx is not None and tx.get('confirmations') > MIN_CONFIRMATIONS:
confirmations = tx.get('confirmations')
if tx is not None and confirmations > MIN_CONFIRMATIONS:
# The end of the appointment has been reached
completed_jobs.append(uuid)
completed_jobs.append((uuid, confirmations))
return completed_jobs