MCPcopy Create free account
hub / github.com/LUX-Core/lux / GetMajorVersionFromVersion

Function GetMajorVersionFromVersion

src/main.cpp:6373–6385  ·  view source on GitHub ↗

* Parses major version from version string. * * Version string is expected to be [any text]:X.X[.X[any text]]. * As an example, Luxcore uses /Luxcore:X.X.X/ version string. So, this function will * return 5 for /Luxcore:5.0.0/ or 0 if it couldn't find ":" or "." delimeters, or if no digits are between * those delimeters, or if string verison is empty * @param cleanVersion Luxcore wallet vers

Source from the content-addressed store, hash-verified

6371 * @return Major Luxcore major version or 0
6372 */
6373int GetMajorVersionFromVersion(const string& cleanVersion) {
6374 size_t delimPos = cleanVersion.find(":");
6375 size_t dotPos = cleanVersion.find(".", delimPos + 1);
6376 if (delimPos != string::npos && dotPos != string::npos && dotPos < cleanVersion.length()) {
6377 string strMajorVer = cleanVersion.substr(delimPos + 1, dotPos - delimPos);
6378 istringstream ss(strMajorVer);
6379 int majorVersion;
6380 ss >> majorVersion;
6381 return majorVersion;
6382 } else {
6383 return 0;
6384 }
6385}
6386
6387static bool ProcessMessage(CNode* pfrom, const string &strCommand, CDataStream& vRecv, int64_t nTimeReceived, const CChainParams& chainparams)
6388{

Callers 1

ProcessMessageFunction · 0.85

Calls 2

findMethod · 0.45
lengthMethod · 0.45

Tested by

no test coverage detected