diff --git a/pisa/pisad.py b/pisa/pisad.py index 3bbf476..eae63ff 100644 --- a/pisa/pisad.py +++ b/pisa/pisad.py @@ -29,13 +29,16 @@ if __name__ == '__main__': # FIXME: Leaving this here for future option/arguments pass - if can_connect_to_bitcoind(): - if in_correct_network(BTC_NETWORK): - # Fire the api - start_api() + try: + if can_connect_to_bitcoind(): + if in_correct_network(BTC_NETWORK): + # Fire the api + start_api() + + else: + logger.error("bitcoind is running on a different network, check conf.py and bitcoin.conf. Shutting down") else: - logger.error("bitcoind is running on a different network, check conf.py and bitcoin.conf. Shutting down") - - else: - logger.error("Can't connect to bitcoind. Shutting down") + logger.error("Can't connect to bitcoind. Shutting down") + except Exception e: + logger.error("There was an error while starting the daemon. Shutting down", error_args=e.args) diff --git a/pisa/watcher.py b/pisa/watcher.py index 10dc7a6..38c1a3d 100644 --- a/pisa/watcher.py +++ b/pisa/watcher.py @@ -22,11 +22,11 @@ class Watcher: self.max_appointments = max_appointments self.zmq_subscriber = None self.responder = Responder() - if SIGNING_KEY_FILE is not None: - self.signing_key = SigningKey.from_pem(open(SIGNING_KEY_FILE).read()) + + if SIGNING_KEY_FILE is None: + raise ValueError("No signing key provided. Please fix your pisa.conf") else: - self.signing_key = None - logger.warning("No signing key provided. Appointments will not be signed.") + self.signing_key = SigningKey.from_pem(open(SIGNING_KEY_FILE).read()) def add_appointment(self, appointment): # Rationale: