Ejemplo n.º 1
0
    def setUpClass(cls):
        print('Preparing Tests ...')
        # cls._exec = bitprim.Executor("", sys.stdout, sys.stderr)
        cls._exec = bitprim.Executor("", None, None)
        res = cls._exec.init_chain()

        # if not res:
        #     raise RuntimeError('init_chain() failed')

        res = cls._exec.run_wait()
        if not res:
            print(res)
            raise RuntimeError('run_wait() failed')

        cls.chain = cls._exec.chain
Ejemplo n.º 2
0
def do_test():
    print('Preparing execution ...')
    # execu = bitprim.Executor("", sys.stdout, sys.stderr)
    execu = bitprim.Executor("", None, None)
    res = execu.init_chain()
    print(res)

    # if not res:
    #     raise RuntimeError('init_chain() failed')

    res = execu.run_wait()
    print(res)
    if not res:
        raise RuntimeError('run_wait() failed')

    # chain = execu.chain

    # wait_until_block(execu.chain, 170)

    print('Finishing')
Ejemplo n.º 3
0
def main():
    signal.signal(signal.SIGINT, signal_handler)
    signal.signal(signal.SIGTERM, signal_handler)

    with bitprim.Executor("/home/bitprim/fer/cash.cfg", sys.stdout,
                          sys.stderr) as execut:
        if not os.path.isdir("./blockchain"):
            res = execut.init_chain()
            print(res)

        res = execut.run_wait()
        if not res:
            return

        print(res)

        execut.chain.subscribe_blockchain(subscribe_blockchain_handler)

        loops = 0
        while not execut.stopped:
            execut.chain.fetch_last_height(last_height_fetch_handler)
            time.sleep(5)
Ejemplo n.º 4
0
def main():
    # execut = bitprim.Executor("/home/fernando/execution_tests/btc_mainnet.cfg", sys.stdout, sys.stderr)
    with bitprim.Executor("/home/fernando/execution_tests/btc_mainnet.cfg",
                          sys.stdout, sys.stderr) as execut:

        if not os.path.isdir("./blockchain"):
            res = execut.init_chain()
            print(res)

        res = execut.run_wait()
        if not res:
            return

        # execut.chain.subscribe_blockchain(subscribe_blockchain_handler)
        execut.chain.subscribe_blockchain(BlockHandler(execut))

        # ----------------------------------------------------------------------------------------------------
        cherrypy.config.update({
            'server.socket_host': '0.0.0.0',
            'server.socket_port': 8080,
        })
        cherrypy.quickstart(Root())
Ejemplo n.º 5
0
    error, height = get_last_height(chain)
    while error == 0 and height < desired_height:
        error, height = get_last_height(chain)
        if height < desired_height:
            time.sleep(10)


# --------------------------------------

# import pdb
# import yourmodule
# pdb.run('yourmodule.foo()')

print('Preparing execution ...')
# execu = bitprim.Executor("", sys.stdout, sys.stderr)
execu = bitprim.Executor("", None, None)
res = execu.init_chain()

print(res)
# if not res:
#     raise RuntimeError('init_chain() failed')

res = execu.run_wait()
print(res)

if not res:
    raise RuntimeError('run_wait() failed')

print('Finishing')
# cls._exec.stop()
# cls._exec._destroy()
Ejemplo n.º 6
0
    # if h >= 262421:
    # 	e.fetch_history('1MLVpZC2CTFHheox8SCEnAbW5NBdewRTdR', 0, 0, history_fetch_handler) # Juan







# # ------------------------------------------------------
# # Main Real
# # ------------------------------------------------------
signal.signal(signal.SIGINT, signal_handler)
signal.signal(signal.SIGTERM, signal_handler)

with bitprim.Executor("/home/fernando/execution_tests/btc_mainnet.cfg", sys.stdout, sys.stderr) as execut:
# with bitprim.Executor("/home/fernando/execution_tests/btc_mainnet.cfg") as execut:

    res = execut.init_chain()
    print(res)

    # ------------

    res = execut.init_chain()
    print(res)

    res = execut.run_wait()
    print(res)

    while True:
        execut.chain.fetch_last_height(last_height_fetch_handler)
Ejemplo n.º 7
0
 def setUp(self):
     print('Preparing Binary Tests')
     self.executor = bitprim.Executor(
         "/home/fernando/execution_tests/btc_mainnet.cfg", sys.stdout,
         sys.stderr)