def main():
    parser = argparse.ArgumentParser("analyze hotspots", add_help=True)
    parser.add_argument('-x', help='report to run', choices=['poc_reliability', 'poc_v10'], required=True)

    parser.add_argument('-c', '--challenges', help='number of challenges to analyze, default:500', default=500, type=int)
    parser.add_argument('-n', '--name', help='hotspot name to analyze with dashes-between-words')
    parser.add_argument('-a', '--address', help='hotspot address to analyze')

    args = parser.parse_args()

    H = Hotspots()
    hotspot = None
    if args.name:
        hotspot = H.get_hotspot_by_name(args.name)
        if hotspot is None:
            raise ValueError(f"could not find hotspot named '{args.name}' use dashes between words")
    elif args.address:
        hotspot = H.get_hotspot_by_addr(args.address)
        if hotspot is None:
            raise ValueError(f"could not find hotspot address '{args.address}' ")
    else:
        raise ValueError("must provide hotspot address '--address' or name '--name'")

    challenges = utils.load_challenges(hotspot['address'], args.challenges)
    if args.x == 'poc_reliability':
        poc_reliability(hotspot, challenges)
    elif args.x == 'poc_v10':
        pocv10_violations(hotspot, challenges)
Пример #2
0
def main():
    parser = argparse.ArgumentParser("analyze hotspots", add_help=True)
    parser.add_argument(
        '-x',
        help='report to run',
        choices=['poc_reliability', 'poc_v10', 'poc_polar', 'poc_summary'],
        required=True)

    parser.add_argument('-c',
                        '--challenges',
                        help='number of challenges to analyze, default:500',
                        default=500,
                        type=int)
    parser.add_argument(
        '-n',
        '--name',
        help='hotspot name to analyze with dashes-between-words')
    parser.add_argument('-a', '--address', help='hotspot address to analyze')

    args = parser.parse_args()
    H = Hotspots()
    hotspot = None
    if args.name:
        hotspot = H.get_hotspot_by_name(args.name)
        if hotspot is None:
            raise ValueError(
                f"could not find hotspot named '{args.name}' use dashes between words"
            )
    elif args.address:
        hotspot = H.get_hotspot_by_addr(args.address)
        if hotspot is None:
            raise ValueError(
                f"could not find hotspot address '{args.address}' ")
    else:
        raise ValueError(
            "must provide hotspot address '--address' or name '--name'")

    challenges = utils.load_challenges(hotspot['address'], args.challenges)
    challenges = challenges[:args.challenges]
    if len(challenges) < 2:
        print(
            f"ERROR could not load challenges, either hotspot has been offline too long or you need to increase --challenge arguement"
        )
        return
    days, remainder = divmod(challenges[0]['time'] - challenges[-1]['time'],
                             3600 * 24)
    hours = int(round(remainder / 3600, 0))
    print(
        f"analyzing {len(challenges)} challenges from block {challenges[0]['height']}-{challenges[-1]['height']} over {days} days, {hours} hrs"
    )

    if args.x == 'poc_summary':
        poc_summary(hotspot, challenges)
    if args.x == 'poc_reliability':
        poc_reliability(hotspot, challenges)
    if args.x == 'poc_polar':
        poc_polar(hotspot, challenges)
    if args.x == 'poc_v10':
        pocv10_violations(hotspot, challenges)
Пример #3
0
def main():
    parser = argparse.ArgumentParser("analyze hotspots", add_help=True)
    parser.add_argument('-x', help='report to run', choices=['beacons', 'witnesses', 'challenges'], required=True)
    parser.add_argument('-c', '--challenges', help='number of challenges to analyze, default:400', default=400, type=int)
    parser.add_argument('-n', '--name', help='hotspot name to analyze with dashes-between-words')
    parser.add_argument('-a', '--address', help='hotspot address to analyze')
    parser.add_argument('-d', '--details', help='return detailed report (listing each activity)', action='store_true')

    args = parser.parse_args()

    H = Hotspots()
    hotspot = None
    if args.name:
        hotspot = H.get_hotspot_by_name(args.name)
        if hotspot is None:
            raise ValueError(f"could not find hotspot named '{args.name}' use dashes between words")
    elif args.address:
        hotspot = H.get_hotspot_by_addr(args.address)
        if hotspot is None:
            raise ValueError(f"could not find hotspot address '{args.address}' ")
    else:
        raise ValueError("must provide hotspot address '--address' or name '--name'")

    challenges = utils.load_challenges(hotspot['address'], args.challenges)
    challenges = challenges[:args.challenges]
    if len(challenges) < 2:
        print(f"ERROR could not load challenges, either hotspot has been offline too long or you need to increase --challenge arguement")
        return
    days, remainder = divmod(challenges[0]['time'] - challenges[-1]['time'], 3600 * 24)
    hours = int(round(remainder / 3600, 0))
    print(f"analyzing {len(challenges)} challenges from block {challenges[0]['height']}-{challenges[-1]['height']} over {days} days, {hours} hrs")

    if args.x == 'beacons':
        transmit_details(hotspot, challenges, smry_only=not args.details)
    elif args.x == 'witnesses':
        witness_detail(hotspot, challenges, smry_only=not args.details)
    elif args.x == 'challenges':
        challenger_details(hotspot, challenges, smry_only=not args.details)
    else:
        print(f"unsupported report")
Пример #4
0
                        ],
                        help="action to take",
                        required=True)
    parser.add_argument(
        '-n',
        '--name',
        help='hotspot name to analyze with dashes-between-words')
    parser.add_argument('-f', '--file', help='data file(s) for tax processing')
    parser.add_argument('-y', '--year', help='filter to a given tax year')
    args = parser.parse_args()
    H = Hotspots()
    hotspots = []
    if args.name:
        names = args.name.split(',')
        for name in names:
            hotspot = H.get_hotspot_by_name(name)
            if hotspot is None:
                raise ValueError(
                    f"could not find hotspot named '{name}' use dashes between words"
                )
            hotspots.append(hotspot)
    year = -1
    if args.year:
        year = int(args.year)
        print(f"running for tax year: {year}")

    if args.x == 'refresh_hotspots':
        load_hotspots(True)
    if args.x == 'hnt_rewards':
        load_hnt_rewards(hotspots)
    if args.x == 'tax_lots':