@@ -386,7 +386,9 @@ class NetinfoRequestHandler : public BaseRequestHandler
386386 bool IsVersionSelected () const { return m_details_level == 3 || m_details_level == 4 ; }
387387 bool m_is_asmap_on{false };
388388 size_t m_max_addr_length{0 };
389- size_t m_max_age_length{3 };
389+ size_t m_max_addr_processed_length{5 };
390+ size_t m_max_addr_rate_limited_length{6 };
391+ size_t m_max_age_length{5 };
390392 size_t m_max_id_length{2 };
391393 struct Peer {
392394 std::string addr;
@@ -396,6 +398,8 @@ class NetinfoRequestHandler : public BaseRequestHandler
396398 std::string age;
397399 double min_ping;
398400 double ping;
401+ int64_t addr_processed;
402+ int64_t addr_rate_limited;
399403 int64_t last_blck;
400404 int64_t last_recv;
401405 int64_t last_send;
@@ -483,6 +487,8 @@ class NetinfoRequestHandler : public BaseRequestHandler
483487 const int peer_id{peer[" id" ].get_int ()};
484488 const int mapped_as{peer[" mapped_as" ].isNull () ? 0 : peer[" mapped_as" ].get_int ()};
485489 const int version{peer[" version" ].get_int ()};
490+ const int64_t addr_processed{peer[" addr_processed" ].isNull () ? 0 : peer[" addr_processed" ].get_int64 ()};
491+ const int64_t addr_rate_limited{peer[" addr_rate_limited" ].isNull () ? 0 : peer[" addr_rate_limited" ].get_int64 ()};
486492 const int64_t conn_time{peer[" conntime" ].get_int64 ()};
487493 const int64_t last_blck{peer[" last_block" ].get_int64 ()};
488494 const int64_t last_recv{peer[" lastrecv" ].get_int64 ()};
@@ -495,8 +501,10 @@ class NetinfoRequestHandler : public BaseRequestHandler
495501 const std::string sub_version{peer[" subver" ].get_str ()};
496502 const bool is_bip152_hb_from{peer[" bip152_hb_from" ].get_bool ()};
497503 const bool is_bip152_hb_to{peer[" bip152_hb_to" ].get_bool ()};
498- m_peers.push_back ({addr, sub_version, conn_type, network, age, min_ping, ping, last_blck, last_recv, last_send, last_trxn, peer_id, mapped_as, version, is_bip152_hb_from, is_bip152_hb_to, is_block_relay, is_outbound});
504+ m_peers.push_back ({addr, sub_version, conn_type, network, age, min_ping, ping, addr_processed, addr_rate_limited, last_blck, last_recv, last_send, last_trxn, peer_id, mapped_as, version, is_bip152_hb_from, is_bip152_hb_to, is_block_relay, is_outbound});
499505 m_max_addr_length = std::max (addr.length () + 1 , m_max_addr_length);
506+ m_max_addr_processed_length = std::max (ToString (addr_processed).length (), m_max_addr_processed_length);
507+ m_max_addr_rate_limited_length = std::max (ToString (addr_rate_limited).length (), m_max_addr_rate_limited_length);
500508 m_max_age_length = std::max (age.length (), m_max_age_length);
501509 m_max_id_length = std::max (ToString (peer_id).length (), m_max_id_length);
502510 m_is_asmap_on |= (mapped_as != 0 );
@@ -509,13 +517,16 @@ class NetinfoRequestHandler : public BaseRequestHandler
509517 // Report detailed peer connections list sorted by direction and minimum ping time.
510518 if (DetailsRequested () && !m_peers.empty ()) {
511519 std::sort (m_peers.begin (), m_peers.end ());
512- result += strprintf (" <-> type net mping ping send recv txn blk hb %*s " , m_max_age_length, " age" );
520+ result += strprintf (" <-> type net mping ping send recv txn blk hb %*s%*s%*s " ,
521+ m_max_addr_processed_length, " addrp" ,
522+ m_max_addr_rate_limited_length, " addrl" ,
523+ m_max_age_length, " age" );
513524 if (m_is_asmap_on) result += " asmap " ;
514525 result += strprintf (" %*s %-*s%s\n " , m_max_id_length, " id" , IsAddressSelected () ? m_max_addr_length : 0 , IsAddressSelected () ? " address" : " " , IsVersionSelected () ? " version" : " " );
515526 for (const Peer& peer : m_peers) {
516527 std::string version{ToString (peer.version ) + peer.sub_version };
517528 result += strprintf (
518- " %3s %6s %5s%7s%7s%5s%5s%5s%5s %2s %*s%*i %*s %-*s%s\n " ,
529+ " %3s %6s %5s%7s%7s%5s%5s%5s%5s %2s %*s%*s%*s%* i %*s %-*s%s\n " ,
519530 peer.is_outbound ? " out" : " in" ,
520531 ConnectionTypeForNetinfo (peer.conn_type ),
521532 peer.network ,
@@ -526,6 +537,10 @@ class NetinfoRequestHandler : public BaseRequestHandler
526537 peer.last_trxn == 0 ? " " : ToString ((m_time_now - peer.last_trxn ) / 60 ),
527538 peer.last_blck == 0 ? " " : ToString ((m_time_now - peer.last_blck ) / 60 ),
528539 strprintf (" %s%s" , peer.is_bip152_hb_to ? " ." : " " , peer.is_bip152_hb_from ? " *" : " " ),
540+ m_max_addr_processed_length, // variable spacing
541+ peer.addr_processed ? ToString (peer.addr_processed ) : " " ,
542+ m_max_addr_rate_limited_length, // variable spacing
543+ peer.addr_rate_limited ? ToString (peer.addr_rate_limited ) : " " ,
529544 m_max_age_length, // variable spacing
530545 peer.age ,
531546 m_is_asmap_on ? 7 : 0 , // variable spacing
@@ -536,7 +551,7 @@ class NetinfoRequestHandler : public BaseRequestHandler
536551 IsAddressSelected () ? peer.addr : " " ,
537552 IsVersionSelected () && version != " 0" ? version : " " );
538553 }
539- result += strprintf (" ms ms sec sec min min %*s\n\n " , m_max_age_length, " min" );
554+ result += strprintf (" ms ms sec sec min min %*s\n\n " , m_max_age_length, " min" );
540555 }
541556
542557 // Report peer connection totals by type.
@@ -614,6 +629,8 @@ class NetinfoRequestHandler : public BaseRequestHandler
614629 " hb High-bandwidth BIP152 compact block relay\n "
615630 " \" .\" (to) - we selected the peer as a high-bandwidth peer\n "
616631 " \" *\" (from) - the peer selected us as a high-bandwidth peer\n "
632+ " addrp Total number of addresses processed, excluding those dropped due to rate limiting\n "
633+ " addrl Total number of addresses dropped due to rate limiting\n "
617634 " age Duration of connection to the peer, in minutes\n "
618635 " asmap Mapped AS (Autonomous System) number in the BGP route to the peer, used for diversifying\n "
619636 " peer selection (only displayed if the -asmap config option is set)\n "
0 commit comments