Пример #1
0
    return parser.parse_args()


if __name__ == '__main__':
    args = parse_args()
    logging.debug(args)

    stub = connect(args.mobilecoind_host, args.mobilecoind_port)
    block_count = stub.GetLedgerInfo(Empty()).block_count
    total = 0
    for keyfile in sorted(
            filter(lambda x: x.endswith(".json"), os.listdir(args.key_dir))):
        logging.info("%s", keyfile)

        account_data = load_key_and_register(
            os.path.join(args.key_dir, keyfile), stub)

        # Get starting balance
        request = mobilecoind_api_pb2.GetMonitorStatusRequest(
            monitor_id=account_data.monitor_id)
        monitor_block = stub.GetMonitorStatus(request).status.next_block
        if block_count != monitor_block:
            logging.info("Account not synced")
        else:
            resp = stub.GetBalance(
                mobilecoind_api_pb2.GetBalanceRequest(
                    monitor_id=account_data.monitor_id))
            balance = resp.balance
            total += balance
            logging.info("Balance: %s", resp.balance)
            # Remove balances of 0 FIXME: MC-367 also from mobilecoind wallet
Пример #2
0
    assert tx_stats[0]['status'] == TransferStatus.success, "Transfer did not succeed"
    return stats

# When Comparing filenames, make shorter file names compare less than longer filenames,
# using this key function
def filename_key(filename):
    return (len(filename), filename);


if __name__ == '__main__':
    args = parse_args()
    logging.debug(args)

    stub = connect(args.mobilecoind_host, args.mobilecoind_port)
    source_accounts = [
        load_key_and_register(account_key, stub)
        for account_key in sorted(glob.glob(os.path.join(args.key_dir, '*.json')), key=filename_key)
    ]

    dest_b58addresses = [
        read_file(b58_pubfile)
        for b58_pubfile in sorted(glob.glob(os.path.join(args.dest_key_dir, '*.b58pub')), key=filename_key)
    ]

    # convert from b58 to external.PublicAddress using mobilecoind helpers
    dest_addresses = [
        stub.ParseAddressCode(mobilecoind_api_pb2.ParseAddressCodeRequest(b58_code = b58)).receiver
        for b58 in dest_b58addresses
    ]

    # Go through each account and have all their friends transact to them
Пример #3
0
    }
    stats = poll(monitor_id, tx_stats, stub)
    # FIXME: Move max seconds check inside polling
    assert tx_stats[0]['time_delta'] < max_seconds, "Did not clear in time"
    assert tx_stats[0][
        'status'] == TransferStatus.success, "Transfer did not succeed"
    return stats


if __name__ == '__main__':
    args = parse_args()
    logging.debug(args)

    stub = connect(args.mobilecoind_host, args.mobilecoind_port)
    accounts = [
        load_key_and_register(k, stub)
        for k in sorted(glob.glob(os.path.join(args.key_dir, '*.json')))
    ]

    monitor_ids = [a.monitor_id for a in accounts]
    # Go through each account and have all their friends transact to them
    for i, account_data in enumerate(accounts):
        wait_for_accounts_sync(stub, monitor_ids, 3)
        # Get starting balance
        resp = stub.GetBalance(
            mobilecoind_api_pb2.GetBalanceRequest(
                monitor_id=account_data.monitor_id))
        balance = resp.balance
        logging.info("Starting balance for account %s: %s", i, resp.balance)

        # Note: due to the transaction fee, we can't assume we have enough funds