2022-04-04 16:34:51 +02:00
|
|
|
import os
|
2022-03-29 22:06:44 +02:00
|
|
|
import logging
|
|
|
|
import traceback
|
|
|
|
import argparse
|
|
|
|
from scribe.env import Env
|
|
|
|
from scribe.common import setup_logging
|
|
|
|
from scribe.blockchain.service import BlockchainProcessorService
|
|
|
|
|
|
|
|
|
|
|
|
def main():
|
|
|
|
parser = argparse.ArgumentParser(
|
|
|
|
prog='scribe'
|
|
|
|
)
|
2022-04-22 00:13:46 +02:00
|
|
|
Env.contribute_common_settings_to_arg_parser(parser)
|
|
|
|
Env.contribute_writer_settings_to_arg_parser(parser)
|
2022-03-29 22:06:44 +02:00
|
|
|
args = parser.parse_args()
|
2022-04-04 16:34:51 +02:00
|
|
|
|
2022-03-29 22:06:44 +02:00
|
|
|
try:
|
2022-04-04 16:34:51 +02:00
|
|
|
env = Env.from_arg_parser(args)
|
|
|
|
setup_logging(os.path.join(env.db_dir, 'scribe.log'))
|
|
|
|
block_processor = BlockchainProcessorService(env)
|
2022-03-29 22:06:44 +02:00
|
|
|
block_processor.run()
|
|
|
|
except Exception:
|
|
|
|
traceback.print_exc()
|
|
|
|
logging.critical('scribe terminated abnormally')
|
|
|
|
else:
|
|
|
|
logging.info('scribe terminated normally')
|
|
|
|
|
|
|
|
|
|
|
|
if __name__ == "__main__":
|
|
|
|
main()
|