@@ -386,7 +386,9 @@ class NetinfoRequestHandler : public BaseRequestHandler
386
386
bool IsVersionSelected () const { return m_details_level == 3 || m_details_level == 4 ; }
387
387
bool m_is_asmap_on{false };
388
388
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 };
390
392
size_t m_max_id_length{2 };
391
393
struct Peer {
392
394
std::string addr;
@@ -396,6 +398,8 @@ class NetinfoRequestHandler : public BaseRequestHandler
396
398
std::string age;
397
399
double min_ping;
398
400
double ping;
401
+ int64_t addr_processed;
402
+ int64_t addr_rate_limited;
399
403
int64_t last_blck;
400
404
int64_t last_recv;
401
405
int64_t last_send;
@@ -483,6 +487,8 @@ class NetinfoRequestHandler : public BaseRequestHandler
483
487
const int peer_id{peer[" id" ].get_int ()};
484
488
const int mapped_as{peer[" mapped_as" ].isNull () ? 0 : peer[" mapped_as" ].get_int ()};
485
489
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 ()};
486
492
const int64_t conn_time{peer[" conntime" ].get_int64 ()};
487
493
const int64_t last_blck{peer[" last_block" ].get_int64 ()};
488
494
const int64_t last_recv{peer[" lastrecv" ].get_int64 ()};
@@ -495,8 +501,10 @@ class NetinfoRequestHandler : public BaseRequestHandler
495
501
const std::string sub_version{peer[" subver" ].get_str ()};
496
502
const bool is_bip152_hb_from{peer[" bip152_hb_from" ].get_bool ()};
497
503
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});
499
505
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);
500
508
m_max_age_length = std::max (age.length (), m_max_age_length);
501
509
m_max_id_length = std::max (ToString (peer_id).length (), m_max_id_length);
502
510
m_is_asmap_on |= (mapped_as != 0 );
@@ -509,13 +517,16 @@ class NetinfoRequestHandler : public BaseRequestHandler
509
517
// Report detailed peer connections list sorted by direction and minimum ping time.
510
518
if (DetailsRequested () && !m_peers.empty ()) {
511
519
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" );
513
524
if (m_is_asmap_on) result += " asmap " ;
514
525
result += strprintf (" %*s %-*s%s\n " , m_max_id_length, " id" , IsAddressSelected () ? m_max_addr_length : 0 , IsAddressSelected () ? " address" : " " , IsVersionSelected () ? " version" : " " );
515
526
for (const Peer& peer : m_peers) {
516
527
std::string version{ToString (peer.version ) + peer.sub_version };
517
528
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 " ,
519
530
peer.is_outbound ? " out" : " in" ,
520
531
ConnectionTypeForNetinfo (peer.conn_type ),
521
532
peer.network ,
@@ -526,6 +537,10 @@ class NetinfoRequestHandler : public BaseRequestHandler
526
537
peer.last_trxn == 0 ? " " : ToString ((m_time_now - peer.last_trxn ) / 60 ),
527
538
peer.last_blck == 0 ? " " : ToString ((m_time_now - peer.last_blck ) / 60 ),
528
539
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 ) : " " ,
529
544
m_max_age_length, // variable spacing
530
545
peer.age ,
531
546
m_is_asmap_on ? 7 : 0 , // variable spacing
@@ -536,7 +551,7 @@ class NetinfoRequestHandler : public BaseRequestHandler
536
551
IsAddressSelected () ? peer.addr : " " ,
537
552
IsVersionSelected () && version != " 0" ? version : " " );
538
553
}
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" );
540
555
}
541
556
542
557
// Report peer connection totals by type.
@@ -614,6 +629,8 @@ class NetinfoRequestHandler : public BaseRequestHandler
614
629
" hb High-bandwidth BIP152 compact block relay\n "
615
630
" \" .\" (to) - we selected the peer as a high-bandwidth peer\n "
616
631
" \" *\" (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 "
617
634
" age Duration of connection to the peer, in minutes\n "
618
635
" asmap Mapped AS (Autonomous System) number in the BGP route to the peer, used for diversifying\n "
619
636
" peer selection (only displayed if the -asmap config option is set)\n "
0 commit comments