Changeset View
Changeset View
Standalone View
Standalone View
src/addrman.cpp
Show First 20 Lines • Show All 752 Lines • ▼ Show 20 Lines | std::vector<bool> CAddrMan::DecodeAsmap(fs::path path) { | ||||
fseek(filestr, 0, SEEK_SET); | fseek(filestr, 0, SEEK_SET); | ||||
char cur_byte; | char cur_byte; | ||||
for (int i = 0; i < length; ++i) { | for (int i = 0; i < length; ++i) { | ||||
file >> cur_byte; | file >> cur_byte; | ||||
for (int bit = 0; bit < 8; ++bit) { | for (int bit = 0; bit < 8; ++bit) { | ||||
bits.push_back((cur_byte >> bit) & 1); | bits.push_back((cur_byte >> bit) & 1); | ||||
} | } | ||||
} | } | ||||
if (!SanityCheckASMap(bits)) { | |||||
LogPrintf("Sanity check of asmap file %s failed\n", path); | |||||
return {}; | |||||
} | |||||
return bits; | return bits; | ||||
} | } |