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

Function AddrmanEntryToJSON

src/rpc/net.cpp:1184–1203  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1182}
1183
1184UniValue AddrmanEntryToJSON(const AddrInfo& info, const CConnman& connman)
1185{
1186 UniValue ret(UniValue::VOBJ);
1187 ret.pushKV("address", info.ToStringAddr());
1188 const uint32_t mapped_as{connman.GetMappedAS(info)};
1189 if (mapped_as) {
1190 ret.pushKV("mapped_as", mapped_as);
1191 }
1192 ret.pushKV("port", info.GetPort());
1193 ret.pushKV("services", static_cast<std::underlying_type_t<decltype(info.nServices)>>(info.nServices));
1194 ret.pushKV("time", TicksSinceEpoch<std::chrono::seconds>(info.nTime));
1195 ret.pushKV("network", GetNetworkName(info.GetNetClass()));
1196 ret.pushKV("source", info.source.ToStringAddr());
1197 ret.pushKV("source_network", GetNetworkName(info.source.GetNetClass()));
1198 const uint32_t source_mapped_as{connman.GetMappedAS(info.source)};
1199 if (source_mapped_as) {
1200 ret.pushKV("source_mapped_as", source_mapped_as);
1201 }
1202 return ret;
1203}
1204
1205UniValue AddrmanTableToJSON(const std::vector<std::pair<AddrInfo, AddressPosition>>& tableInfos, const CConnman& connman)
1206{

Callers 1

AddrmanTableToJSONFunction · 0.85

Calls 6

GetNetworkNameFunction · 0.85
pushKVMethod · 0.80
ToStringAddrMethod · 0.80
GetPortMethod · 0.80
GetNetClassMethod · 0.80
GetMappedASMethod · 0.45

Tested by

no test coverage detected