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

Class NetinfoRequestHandler

src/bitcoin-cli.cpp:385–756  ·  view source on GitHub ↗

Process netinfo requests */

Source from the content-addressed store, hash-verified

383
384/** Process netinfo requests */
385class NetinfoRequestHandler : public BaseRequestHandler
386{
387private:
388 std::array<std::array<uint16_t, NETWORKS.size() + 1>, 3> m_counts{{{}}}; //!< Peer counts by (in/out/total, networks/total)
389 uint8_t m_block_relay_peers_count{0};
390 uint8_t m_manual_peers_count{0};
391 uint8_t m_details_level{0}; //!< Optional user-supplied arg to set dashboard details level
392 bool DetailsRequested() const { return m_details_level; }
393 bool IsAddressSelected() const { return m_details_level == 2 || m_details_level == 4; }
394 bool IsVersionSelected() const { return m_details_level == 3 || m_details_level == 4; }
395 bool m_outbound_only_selected{false};
396 bool m_is_asmap_on{false};
397 size_t m_max_addr_length{0};
398 size_t m_max_addr_processed_length{5};
399 size_t m_max_addr_rate_limited_length{6};
400 size_t m_max_age_length{5};
401 size_t m_max_id_length{2};
402 size_t m_max_services_length{6};
403 struct Peer {
404 std::string addr;
405 std::string sub_version;
406 std::string conn_type;
407 std::string network;
408 std::string age;
409 std::string services;
410 std::string transport_protocol_type;
411 double min_ping;
412 double ping;
413 int64_t addr_processed;
414 int64_t addr_rate_limited;
415 int64_t last_blck;
416 int64_t last_recv;
417 int64_t last_send;
418 int64_t last_trxn;
419 int id;
420 int mapped_as;
421 int version;
422 bool is_addr_relay_enabled;
423 bool is_bip152_hb_from;
424 bool is_bip152_hb_to;
425 bool is_outbound;
426 bool is_tx_relay;
427 bool operator<(const Peer& rhs) const { return std::tie(is_outbound, min_ping) < std::tie(rhs.is_outbound, rhs.min_ping); }
428 };
429 std::vector<Peer> m_peers;
430 std::string ChainToString() const
431 {
432 switch (gArgs.GetChainType()) {
433 case ChainType::TESTNET4:
434 return " testnet4";
435 case ChainType::TESTNET:
436 return " testnet";
437 case ChainType::SIGNET:
438 return " signet";
439 case ChainType::REGTEST:
440 return " regtest";
441 case ChainType::MAIN:
442 return "";

Callers 1

CommandLineRPCFunction · 0.85

Calls 1

sizeMethod · 0.45

Tested by

no test coverage detected