def main(): from socket import gethostname nickname = 'cj-maker-' + btc.sha256(gethostname())[:6] import sys seed = sys.argv[ 1] # btc.sha256('dont use brainwallets except for holding testnet coins') load_program_config() wallet = Wallet(seed, max_mix_depth=5) jm_single().bc_interface.sync_wallet(wallet) irc = IRCMessageChannel(nickname) maker = Maker(irc, wallet) try: print('connecting to irc') irc.run() except: log.debug('CRASHING, DUMPING EVERYTHING') log.debug('wallet seed = ' + seed) debug_dump_object(wallet, ['addr_cache']) debug_dump_object(maker) import traceback traceback.print_exc()
def main(): from socket import gethostname nickname = 'cj-maker-' + btc.sha256(gethostname())[:6] import sys seed = sys.argv[ 1 ] # btc.sha256('dont use brainwallets except for holding testnet coins') load_program_config() wallet = Wallet(seed, max_mix_depth=5) jm_single().bc_interface.sync_wallet(wallet) irc = IRCMessageChannel(nickname) maker = Maker(irc, wallet) try: print('connecting to irc') irc.run() except: log.debug('CRASHING, DUMPING EVERYTHING') log.debug('wallet seed = ' + seed) debug_dump_object(wallet, ['addr_cache']) debug_dump_object(maker) import traceback traceback.print_exc()
p2p = P2PProtocol(p2p_msg_handler, remote_hostport=remote_hostport, testnet=testnet, socks5_hostport=tor_hostport, heartbeat_interval=20) p2p.run() log.debug('rejected={} relay={} uploaded={}'.format(p2p_msg_handler.rejected, p2p_msg_handler.relay_txes, p2p_msg_handler.uploaded_tx)) if p2p_msg_handler.rejected: return False if p2p_msg_handler.uploaded_tx: return True #if p2p_msg_handler.relay_txes: # continue #node doesnt accept unconfirmed txes, try again return False #never find a node that accepted unconfirms if __name__ == "__main__": load_program_config() class P2PTest(P2PMessageHandler): def __init__(self, blockhash): P2PMessageHandler.__init__(self) self.blockhash = blockhash def on_connected(self, p2p): log.info('sending getaddr') p2p.sock.sendall(p2p.create_message('getaddr', '')) def on_heartbeat(self, p2p): log.info('heartbeat') MSG = 2 #MSG_BLOCK getdata_payload = pack('<BI', 1, MSG) + self.blockhash p2p.sock.sendall(p2p.create_message('getdata', getdata_payload))
def setup_keys(): load_program_config()
def setup_addresses(): load_program_config()