Changeset View
Changeset View
Standalone View
Standalone View
src/seeder/protocol.cpp
Show First 20 Lines • Show All 87 Lines • ▼ Show 20 Lines | void CAddress::print() const { | ||||
printf("CAddress(%s)\n", ToString().c_str()); | printf("CAddress(%s)\n", ToString().c_str()); | ||||
} | } | ||||
CInv::CInv() { | CInv::CInv() { | ||||
type = 0; | type = 0; | ||||
hash.SetNull(); | hash.SetNull(); | ||||
} | } | ||||
CInv::CInv(int typeIn, const uint256 &hashIn) { | CInv::CInv(uint32_t typeIn, const uint256 &hashIn) { | ||||
type = typeIn; | type = typeIn; | ||||
hash = hashIn; | hash = hashIn; | ||||
} | } | ||||
CInv::CInv(const std::string &strType, const uint256 &hashIn) { | CInv::CInv(const std::string &strType, const uint256 &hashIn) { | ||||
int i; | size_t i; | ||||
for (i = 1; i < ARRAYLEN(ppszTypeName); i++) { | for (i = 1; i < ARRAYLEN(ppszTypeName); i++) { | ||||
if (strType == ppszTypeName[i]) { | if (strType == ppszTypeName[i]) { | ||||
type = i; | type = i; | ||||
break; | break; | ||||
} | } | ||||
} | } | ||||
if (i == ARRAYLEN(ppszTypeName)) | |||||
if (i == ARRAYLEN(ppszTypeName)) { | |||||
throw std::out_of_range("CInv::CInv(string, uint256) : unknown type"); | throw std::out_of_range("CInv::CInv(string, uint256) : unknown type"); | ||||
} | |||||
hash = hashIn; | hash = hashIn; | ||||
} | } | ||||
bool operator<(const CInv &a, const CInv &b) { | bool operator<(const CInv &a, const CInv &b) { | ||||
return (a.type < b.type || (a.type == b.type && a.hash < b.hash)); | return (a.type < b.type || (a.type == b.type && a.hash < b.hash)); | ||||
} | } | ||||
bool CInv::IsKnownType() const { | bool CInv::IsKnownType() const { | ||||
Show All 16 Lines |