Minor refactor

Runs chain_monitor as daemon so it terminates along with the main thread. Reorders attack_responder so it is in the same stanza as attack_watcher
This commit is contained in:
Sergi Delgado Segura
2020-01-03 13:35:52 +01:00
parent c594018dce
commit 3889d30e31
2 changed files with 4 additions and 5 deletions

View File

@@ -53,11 +53,11 @@ class ChainMonitor:
def monitor_chain(self):
self.best_tip = BlockProcessor.get_best_block_hash()
Thread(target=self.monitor_chain_polling).start()
Thread(target=self.monitor_chain_zmq).start()
Thread(target=self.monitor_chain_polling, daemon=True).start()
Thread(target=self.monitor_chain_zmq, daemon=True).start()
def monitor_chain_polling(self):
while self.terminate:
while not self.terminate:
self.check_tip.wait(timeout=60)
# Terminate could have been set wile the thread was blocked in wait