public NodeConnection(Bitcoin owner, string nodeAddress, ushort port = 8333, uint protocolVersion = 0x00011171, uint networkID = 0xD9B4BEF9) { mOwner = owner; mProtocolVersion = protocolVersion; mPort = port; mNetworkID = networkID; mNodeAddress = nodeAddress; mFetchingHeaders = false; mPacketProcessors = new Dictionary<string, PacketProcessor>(); mPacketProcessors.Add("version", PH_Version); mPacketProcessors.Add("verack", PH_Verack); mPacketProcessors.Add("addr", PH_Addr); mPacketProcessors.Add("inv", PH_Inv); mPacketProcessors.Add("getdata", PH_GetData); mPacketProcessors.Add("notfound", PH_NotFound); mPacketProcessors.Add("getblocks", PH_GetBlocks); mPacketProcessors.Add("getheaders", PH_GetHeaders); mPacketProcessors.Add("tx", PH_Tx); mPacketProcessors.Add("block", PH_Block); mPacketProcessors.Add("headers", PH_Headers); mPacketProcessors.Add("getaddr", PH_GetAddr); mPacketProcessors.Add("mempool", PH_Mempool); mPacketProcessors.Add("checkorder", PH_CheckOrder); mPacketProcessors.Add("submitorder", PH_Subimtorder); mPacketProcessors.Add("reply", PH_Reply); mPacketProcessors.Add("ping", PH_Ping); mPacketProcessors.Add("pong", PH_Pong); mPacketProcessors.Add("alert", PH_Alert); mThread = new Thread(new ThreadStart(ReadSocket)); mThread.Name = owner.Name + "-" + mNodeAddress + ":" + mPort; mThread.Start(); }
public NodeConnection(Bitcoin owner, string nodeAddress, ushort port = 8333, uint protocolVersion = 0x00011171, uint networkID = 0xD9B4BEF9) { mOwner = owner; mProtocolVersion = protocolVersion; mPort = port; mNetworkID = networkID; mNodeAddress = nodeAddress; mFetchingHeaders = false; mPacketProcessors = new Dictionary <string, PacketProcessor>(); mPacketProcessors.Add("version", PH_Version); mPacketProcessors.Add("verack", PH_Verack); mPacketProcessors.Add("addr", PH_Addr); mPacketProcessors.Add("inv", PH_Inv); mPacketProcessors.Add("getdata", PH_GetData); mPacketProcessors.Add("notfound", PH_NotFound); mPacketProcessors.Add("getblocks", PH_GetBlocks); mPacketProcessors.Add("getheaders", PH_GetHeaders); mPacketProcessors.Add("tx", PH_Tx); mPacketProcessors.Add("block", PH_Block); mPacketProcessors.Add("headers", PH_Headers); mPacketProcessors.Add("getaddr", PH_GetAddr); mPacketProcessors.Add("mempool", PH_Mempool); mPacketProcessors.Add("checkorder", PH_CheckOrder); mPacketProcessors.Add("submitorder", PH_Subimtorder); mPacketProcessors.Add("reply", PH_Reply); mPacketProcessors.Add("ping", PH_Ping); mPacketProcessors.Add("pong", PH_Pong); mPacketProcessors.Add("alert", PH_Alert); mThread = new Thread(new ThreadStart(ReadSocket)); mThread.Name = owner.Name + "-" + mNodeAddress + ":" + mPort; mThread.Start(); }