MCPcopy Create free account
hub / github.com/ElementsProject/elements / Read

Method Read

src/addrdb.cpp:143–171  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

141}
142
143bool CBanDB::Read(banmap_t& banSet)
144{
145 if (fs::exists(m_banlist_dat)) {
146 LogPrintf("banlist.dat ignored because it can only be read by " PACKAGE_NAME " version 22.x. Remove %s to silence this warning.\n", fs::quoted(fs::PathToString(m_banlist_dat)));
147 }
148 // If the JSON banlist does not exist, then recreate it
149 if (!fs::exists(m_banlist_json)) {
150 return false;
151 }
152
153 std::map<std::string, util::SettingsValue> settings;
154 std::vector<std::string> errors;
155
156 if (!util::ReadSettings(m_banlist_json, settings, errors)) {
157 for (const auto& err : errors) {
158 LogPrintf("Cannot load banlist %s: %s\n", fs::PathToString(m_banlist_json), err);
159 }
160 return false;
161 }
162
163 try {
164 BanMapFromJson(settings[JSON_KEY], banSet);
165 } catch (const std::runtime_error& e) {
166 LogPrintf("Cannot parse banlist %s: %s\n", fs::PathToString(m_banlist_json), e.what());
167 return false;
168 }
169
170 return true;
171}
172
173bool DumpPeerAddresses(const ArgsManager& args, const AddrMan& addr)
174{

Callers 7

BanManMethod · 0.45
CheckLegacyTxindexFunction · 0.45
GetCoinMethod · 0.45
GetBestBlockMethod · 0.45
GetHeadBlocksMethod · 0.45
RegenerateFullIndexMethod · 0.45
ReceiveMsgBytesMethod · 0.45

Calls 5

existsFunction · 0.85
quotedFunction · 0.85
PathToStringFunction · 0.85
ReadSettingsFunction · 0.85
BanMapFromJsonFunction · 0.85

Tested by

no test coverage detected