def __init__( self, ip, port, verbose=False, wallet="poswallet.json", version="", source_ip="", timeout=10, read_timeout=30, ): """ :param ip: :param port: :param verbose: :param wallet: :param version: :param source_ip: :param timeout: in seconds :param read_timeout: in seconds """ self.ip = ip self.port = port self.verbose = verbose self.client_version = version self.source_ip = source_ip self.timeout = timeout self.read_timeout = read_timeout poscrypto.load_keys(wallet, verbose=self.verbose) self.hello_string = poshelpers.hello_string(port=101)
def test_poschain_digest(benchmark): global NB loop = asyncio.new_event_loop() try: asyncio.set_event_loop(loop) logger = logging.getLogger('foo') test_helpers.remove_pc() poscrypto.load_keys('./bench_wallet.json') test_poschain = poschain.SqlitePosChain(app_log=logger, db_path='./') test_poschain.check() n = 100 # Generate random tx for the block txs = test_helpers.create_txs(n, sign=True, block_height=1) block = posblock.PosBlock() block.height = 1 block.round = 1 block.sir = 1 block.txs = txs # temp = block.to_dict(as_hex=True) # logger.warning(json.dumps(temp)) if benchmark: benchmark(sync_digest_txs, loop, test_poschain, block) else: start = time.time() sync_digest_txs(loop, test_poschain, block) print("{} txs digested in {} sec".format(n, time.time() - start)) sync_poschain_count(loop, test_poschain) test_helpers.remove_pc() NB += 1 finally: loop.close()
def test_tx_sign10nocheck(benchmark): poscrypto.load_keys('./bench_wallet.json') txs = test_helpers.create_txs(10, False) if benchmark: benchmark(sign_txs, txs, False) else: sign_txs(txs)
"--verbose", action="count", default=False, help='Be verbose.') parser.add_argument("--action", type=str, default=None, help='Specific action. ') args = parser.parse_args() if len(sys.argv) == 1: parser.print_help(sys.stderr) sys.exit() try: if args.action == 'genesis': # Displays genesis block info for db insert poscrypto.load_keys("hn_temp/mn0.json") pos_chain = SqlitePosChain(verbose=True) # genesis = pos_chain.genesis_dict() print("TODO") else: # If we are updating, let our previous instance close. time.sleep(1) if args.index >= 0: datadir = "./data{}".format(args.index) if not os.path.exists(datadir): os.makedirs(datadir) suffix = str(args.index) if len(config.POC_HYPER_NODES_LIST) <= 0: """Here, we fill the whole static list from disk to get our index setup. This is only used for dev. In regular cases, we use no -i and take from our poswallet.json only.""" poshelpers.load_hn_temp()
default=False, help='Be verbose.') parser.add_argument("-j", "--json", action="count", default=False, help='Return json content') parser.add_argument("-N", "--interface", type=str, default="", help='Use a specific network interface') # parser.add_argument("--action", type=str, default=None, help='Specific action. ') args = parser.parse_args() wallet_name = "poswallet.json" poscrypto.load_keys(wallet_name) status = {"address": poscrypto.ADDRESS, "errors": []} status['hn_lib_version'] = poshn.__version__ status['config'] = config.load() check_os(status) # check if db exists if not path.isfile(config.POW_LEDGER_DB): status['errors'].append("Bismuth Full ledger not found at {}".format( config.POW_LEDGER_DB)) # check if process runs instances = [ p.info for p in psutil.process_iter(attrs=['pid', 'name', 'exe', 'cmdline']) if 'python' in p.info['name'] and 'hn_instance.py' in p.info['cmdline'] ] nb_instances = len(instances)
def test_tx_signed10(benchmark): poscrypto.load_keys('./bench_wallet.json') if benchmark: benchmark(test_helpers.create_txs, 10, True) else: test_helpers.create_txs(10, True)