MCPcopy Create free account
hub / github.com/bitcoin/bitcoin / AddrmanTableToJSON

Function AddrmanTableToJSON

src/rpc/net.cpp:1205–1219  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1203}
1204
1205UniValue AddrmanTableToJSON(const std::vector<std::pair<AddrInfo, AddressPosition>>& tableInfos, const CConnman& connman)
1206{
1207 UniValue table(UniValue::VOBJ);
1208 for (const auto& e : tableInfos) {
1209 AddrInfo info = e.first;
1210 AddressPosition location = e.second;
1211 std::ostringstream key;
1212 key << location.bucket << "/" << location.position;
1213 // Address manager tables have unique entries so there is no advantage
1214 // in using UniValue::pushKV, which checks if the key already exists
1215 // in O(N). UniValue::pushKVEnd is used instead which currently is O(1).
1216 table.pushKVEnd(key.str(), AddrmanEntryToJSON(info, connman));
1217 }
1218 return table;
1219}
1220
1221static RPCMethod getrawaddrman()
1222{

Callers 1

getrawaddrmanFunction · 0.85

Calls 3

AddrmanEntryToJSONFunction · 0.85
pushKVEndMethod · 0.80
strMethod · 0.80

Tested by

no test coverage detected