X-Git-Url: https://git.novaco.in/?a=blobdiff_plain;f=src%2Fprotocol.cpp;h=676718d829365ebc90dc058e6154191d5a3ea43e;hb=e6bfe9cb90f52486b97b80bd0528626042ea1582;hp=78654e16b12b362362684012885adb4a7f4fe05b;hpb=6b5f812fbb8d1f8c46f82136d6946ce6b3ac2862;p=novacoin.git diff --git a/src/protocol.cpp b/src/protocol.cpp index 78654e1..676718d 100644 --- a/src/protocol.cpp +++ b/src/protocol.cpp @@ -7,22 +7,21 @@ #include "util.h" #include "netbase.h" -#ifndef WIN32 -# include -#endif +// Network ID, previously known as pchMessageStart +uint32_t nNetworkID = 0xe5e9e8e4; static const std::vector vpszTypeName = { "ERROR", "tx", "block" }; CMessageHeader::CMessageHeader() : nMessageSize(std::numeric_limits::max()), nChecksum(0) { - memcpy(pchMessageStart, ::pchMessageStart, sizeof(pchMessageStart)); + nNetworkID = ::nNetworkID; memset(pchCommand, 0, sizeof(pchCommand)); pchCommand[1] = 1; } CMessageHeader::CMessageHeader(const char* pszCommand, unsigned int nMessageSizeIn) : nMessageSize(nMessageSizeIn), nChecksum(0) { - memcpy(pchMessageStart, ::pchMessageStart, sizeof(pchMessageStart)); + nNetworkID = ::nNetworkID; strncpy(pchCommand, pszCommand, COMMAND_SIZE); } @@ -37,7 +36,7 @@ std::string CMessageHeader::GetCommand() const bool CMessageHeader::IsValid() const { // Check start string - if (memcmp(pchMessageStart, ::pchMessageStart, sizeof(pchMessageStart)) != 0) + if (nNetworkID != ::nNetworkID) return false; // Check the command string for errors @@ -66,7 +65,7 @@ bool CMessageHeader::IsValid() const CAddress::CAddress() : CService(), nServices(NODE_NETWORK), nTime(100000000), nLastTry(0) { } CAddress::CAddress(CService ipIn, uint64_t nServicesIn) : CService(ipIn), nServices(nServicesIn), nTime(100000000), nLastTry(0) { } -CInv::CInv() : type(0), hash(0) { } +CInv::CInv() { } CInv::CInv(int typeIn, const uint256& hashIn) : type(typeIn), hash(hashIn) { } CInv::CInv(const std::string& strType, const uint256& hashIn) : hash(hashIn) {