def main(args=sys.argv[1:]): opts = parse_args(args) processor = None try: processor = TransactionProcessor(url=opts.endpoint) log_config = get_log_config(filename="xo_log_config.toml") if log_config is not None: log_configuration(log_config=log_config) else: log_dir = get_log_dir() # use the transaction processor zmq identity for filename log_configuration(log_dir=log_dir, name="xo-" + str(processor.zmq_id)[2:-1]) init_console_logging(verbose_level=opts.verbose) # The prefix should eventually be looked up from the # validator's namespace registry. xo_prefix = hashlib.sha512('xo'.encode("utf-8")).hexdigest()[0:6] handler = XoTransactionHandler(namespace_prefix=xo_prefix) processor.add_handler(handler) processor.start() except KeyboardInterrupt: pass except Exception as e: # pylint: disable=broad-except print("Error: {}".format(e)) finally: if processor is not None: processor.stop()
def main(args=sys.argv[1:]): opts = parse_args(args) init_console_logging(verbose_level=opts.verbose) processor = TransactionProcessor(url=opts.endpoint) # The prefix should eventually be looked up from the # validator's namespace registry. xo_prefix = hashlib.sha512('xo'.encode("utf-8")).hexdigest()[0:6] handler = XoTransactionHandler(namespace_prefix=xo_prefix) processor.add_handler(handler) try: processor.start() except KeyboardInterrupt: pass finally: processor.stop()
def main(args=None): if args is None: args = sys.argv[1:] opts = parse_args(args) processor = None try: arg_config = create_xo_config(opts) xo_config = load_xo_config(arg_config) processor = TransactionProcessor(url=xo_config.connect) log_config = get_log_config(filename="xo_log_config.toml") # If no toml, try loading yaml if log_config is None: log_config = get_log_config(filename="xo_log_config.yaml") if log_config is not None: log_configuration(log_config=log_config) else: log_dir = get_log_dir() # use the transaction processor zmq identity for filename log_configuration( log_dir=log_dir, name="xo-" + str(processor.zmq_id)[2:-1]) init_console_logging(verbose_level=opts.verbose) handler = XoTransactionHandler() processor.add_handler(handler) processor.start() except KeyboardInterrupt: pass except Exception as e: # pylint: disable=broad-except print("Error: {}".format(e)) finally: if processor is not None: processor.stop()