def runsync( jsonrpc, waittime, startblock, required_confirmations, syncid, merge_with_syncid ): logging.basicConfig(level=logging.INFO) logger.info("version %s starting", util.get_version()) # we like to survive a postgresql restart, so we need to catch errors here, # since we must create a new connection in that case. while 1: try: web3 = Web3(Web3.HTTPProvider(jsonrpc, request_kwargs={"timeout": 60})) with connect("") as conn: ensure_sync_entry(conn, syncid) s = Synchronizer( conn, web3, syncid, required_confirmations=required_confirmations, merge_with_syncid=merge_with_syncid, ) s.sync_loop(waittime * 0.001) break except Exception: logger.error( "An error occured in runsync. Will restart runsync in 10 seconds", exc_info=sys.exc_info(), ) time.sleep(10)
def droptables(force): """drop database tables""" logging.basicConfig(level=logging.INFO) logger.info("version %s starting", util.get_version()) if not force: logger.warn("dry-run, please specify --force to really delete the tables") do_droptables(connect(""), force) sys.exit(0 if force else 1) # just in case we forget to add --force
def createtables(): logging.basicConfig(level=logging.INFO) logger.info("version %s starting", util.get_version()) logger.info("creating tables") do_createtables(connect(""))
def importabi(addresses, contracts): logging.basicConfig(level=logging.INFO) logger.info("version %s starting", util.get_version()) do_importabi(connect(""), addresses, contracts)