ch = logging.StreamHandler() ch.setLevel(logging.DEBUG) # create formatter formatter = logging.Formatter( '%(asctime)s - %(name)s - %(levelname)s - %(message)s') # add formatter to ch ch.setFormatter(formatter) # add ch to logger logger.addHandler(ch) mempool = None chaindb = ChainDb(logger) P = TUXParams params = P() bitcoin.params.MESSAGE_START = params.NETMAGIC bitcoin.params.BASE58_PREFIXES = params.BASE58_PREFIXES bitcointx.SelectAlternativeParams(CoreChainParams, P) threads = [] peermgr = PeerManager(logger, mempool, chaindb) c = peermgr.add('45.77.228.139', 42071) threads.append(c) for t in threads: t.start() try: gevent.joinall(threads, timeout=None, raise_error=True) finally: for t in threads: t.kill() gevent.joinall(threads)
def _setup_chain_params(self): # set up chainspecific if self.chain == "ltc": from testchain.util import CoreLitecoinParams, RegtestLitecoinParams bitcointx.SelectAlternativeParams(CoreLitecoinParams, RegtestLitecoinParams)
# create formatter formatter = logging.Formatter( '%(asctime)s - %(name)s - %(levelname)s - %(message)s') # add formatter to ch ch.setFormatter(formatter) # add ch to logger logger.addHandler(ch) P = settings.ChainParams params = P() bitcoin.params.MESSAGE_START = params.NETMAGIC bitcoin.params.BASE58_PREFIXES = params.BASE58_PREFIXES mempool = MemPool(logger) chaindb = ChainDb(logger, mempool, params) bitcointx.SelectAlternativeParams(settings.ChainParams, P) threads = [] peermgr = PeerManager(logger, mempool, chaindb) c = peermgr.add(settings.NODE_IP, P.PORT) threads.append(c) for t in threads: t.start() try: gevent.joinall(threads, timeout=None, raise_error=True) finally: for t in threads: t.kill() gevent.joinall(threads)