def main():
    kzcashd = KZCashDaemon.from_kzcash_conf(config.kzcash_conf)
    options = process_args()
    if (not is_kzcashd_port_open(kzcashd)):
        print('Cannot connect to kzcashd. Please ensure kzcashd is running and the JSONRPC port is open to Sentinel.')
        return
    if (not kzcashd.is_synced()):
        print('kzcashd not synced with network! Awaiting full sync before running Sentinel.')
        return
    if (not kzcashd.is_masternode()):
        print('Invalid Masternode Status, cannot continue.')
        return
    if os.environ.get('SENTINEL_DEBUG', None):
        import logging
        logger = logging.getLogger('peewee')
        logger.setLevel(logging.DEBUG)
        logger.addHandler(logging.StreamHandler())
    if options.bypass:
        printdbg('--bypass-schedule option used, clearing schedule')
        Scheduler.clear_schedule()
    if (not Scheduler.is_run_time()):
        printdbg('Not yet time for an object sync/vote, moving on.')
        return
    if (not options.bypass):
        Scheduler.delay()
    Scheduler.clear_schedule()
    perform_kzcashd_object_sync(kzcashd)
    watchdog_check(kzcashd)
    attempt_superblock_creation(kzcashd)
    Scheduler.schedule_next_run()
def main():
    kzcashd = KZCashDaemon.from_kzcash_conf(config.kzcash_conf)
    options = process_args()
    if (not is_kzcashd_port_open(kzcashd)):
        print('Cannot connect to kzcashd. Please ensure kzcashd is running and the JSONRPC port is open to Sentinel.')
        return
    if (not kzcashd.is_synced()):
        print('kzcashd not synced with network! Awaiting full sync before running Sentinel.')
        return
    if (not kzcashd.is_masternode()):
        print('Invalid Masternode Status, cannot continue.')
        return
    if os.environ.get('SENTINEL_DEBUG', None):
        import logging
        logger = logging.getLogger('peewee')
        logger.setLevel(logging.DEBUG)
        logger.addHandler(logging.StreamHandler())
    if options.bypass:
        printdbg('--bypass-schedule option used, clearing schedule')
        Scheduler.clear_schedule()
    if (not Scheduler.is_run_time()):
        printdbg('Not yet time for an object sync/vote, moving on.')
        return
    if (not options.bypass):
        Scheduler.delay()
    Scheduler.clear_schedule()
    perform_kzcashd_object_sync(kzcashd)
    watchdog_check(kzcashd)
    attempt_superblock_creation(kzcashd)
    Scheduler.schedule_next_run()