| 1203 | } |
| 1204 | |
| 1205 | UniValue 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 | |
| 1221 | static RPCMethod getrawaddrman() |
| 1222 | { |
no test coverage detected