MCPcopy Create free account
hub / github.com/WaykiChain/WaykiChain / IsValid

Method IsValid

src/p2p/protocol.cpp:80–108  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

78}
79
80bool CMessageHeader::IsValid() const
81{
82 // Check start string
83 if (memcmp(pchMessageStart, SysCfg().MessageStart(), MESSAGE_START_SIZE) != 0)
84 return false;
85
86 // Check the command string for errors
87 for (const char* p1 = pchCommand; p1 < pchCommand + COMMAND_SIZE; p1++)
88 {
89 if (*p1 == 0)
90 {
91 // Must be all zeros after the first zero
92 for (; p1 < pchCommand + COMMAND_SIZE; p1++)
93 if (*p1 != 0)
94 return false;
95 }
96 else if (*p1 < ' ' || *p1 > 0x7E)
97 return false;
98 }
99
100 // Message size
101 if (nMessageSize > MAX_SIZE)
102 {
103 LogPrint(BCLog::INFO,"CMessageHeader::IsValid() : (%s, %u bytes) nMessageSize > MAX_SIZE\n", GetCommand(), nMessageSize);
104 return false;
105 }
106
107 return true;
108}
109
110CAddress::CAddress() : CService()
111{

Callers 15

AddKeyMethod · 0.45
PushAddressMethod · 0.45
ProcessMessagesFunction · 0.45
BOOST_AUTO_TEST_CASEFunction · 0.45
BOOST_AUTO_TEST_CASEFunction · 0.45
getsignatureFunction · 0.45
invalidateblockFunction · 0.45
reconsiderblockFunction · 0.45
getblockfailuresFunction · 0.45
wasm_gettableFunction · 0.45
getaccountinfoFunction · 0.45
listcontractsFunction · 0.45

Calls

no outgoing calls

Tested by 2

BOOST_AUTO_TEST_CASEFunction · 0.36
BOOST_AUTO_TEST_CASEFunction · 0.36