@@ -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,13 +398,16 @@ 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;
402
406
int64_t last_trxn;
403
407
int id;
404
408
int mapped_as;
405
409
int version;
410
+ bool is_addr_relay_enabled;
406
411
bool is_bip152_hb_from;
407
412
bool is_bip152_hb_to;
408
413
bool is_block_relay;
@@ -483,6 +488,8 @@ class NetinfoRequestHandler : public BaseRequestHandler
483
488
const int peer_id{peer[" id" ].get_int ()};
484
489
const int mapped_as{peer[" mapped_as" ].isNull () ? 0 : peer[" mapped_as" ].get_int ()};
485
490
const int version{peer[" version" ].get_int ()};
491
+ const int64_t addr_processed{peer[" addr_processed" ].isNull () ? 0 : peer[" addr_processed" ].get_int64 ()};
492
+ const int64_t addr_rate_limited{peer[" addr_rate_limited" ].isNull () ? 0 : peer[" addr_rate_limited" ].get_int64 ()};
486
493
const int64_t conn_time{peer[" conntime" ].get_int64 ()};
487
494
const int64_t last_blck{peer[" last_block" ].get_int64 ()};
488
495
const int64_t last_recv{peer[" lastrecv" ].get_int64 ()};
@@ -493,10 +500,13 @@ class NetinfoRequestHandler : public BaseRequestHandler
493
500
const std::string addr{peer[" addr" ].get_str ()};
494
501
const std::string age{conn_time == 0 ? " " : ToString ((m_time_now - conn_time) / 60 )};
495
502
const std::string sub_version{peer[" subver" ].get_str ()};
503
+ const bool is_addr_relay_enabled{peer[" addr_relay_enabled" ].isNull () ? false : peer[" addr_relay_enabled" ].get_bool ()};
496
504
const bool is_bip152_hb_from{peer[" bip152_hb_from" ].get_bool ()};
497
505
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});
506
+ 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_addr_relay_enabled , is_bip152_hb_from, is_bip152_hb_to, is_block_relay, is_outbound});
499
507
m_max_addr_length = std::max (addr.length () + 1 , m_max_addr_length);
508
+ m_max_addr_processed_length = std::max (ToString (addr_processed).length (), m_max_addr_processed_length);
509
+ m_max_addr_rate_limited_length = std::max (ToString (addr_rate_limited).length (), m_max_addr_rate_limited_length);
500
510
m_max_age_length = std::max (age.length (), m_max_age_length);
501
511
m_max_id_length = std::max (ToString (peer_id).length (), m_max_id_length);
502
512
m_is_asmap_on |= (mapped_as != 0 );
@@ -509,34 +519,41 @@ class NetinfoRequestHandler : public BaseRequestHandler
509
519
// Report detailed peer connections list sorted by direction and minimum ping time.
510
520
if (DetailsRequested () && !m_peers.empty ()) {
511
521
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" );
522
+ result += strprintf (" <-> type net mping ping send recv txn blk hb %*s%*s%*s " ,
523
+ m_max_addr_processed_length, " addrp" ,
524
+ m_max_addr_rate_limited_length, " addrl" ,
525
+ m_max_age_length, " age" );
513
526
if (m_is_asmap_on) result += " asmap " ;
514
527
result += strprintf (" %*s %-*s%s\n " , m_max_id_length, " id" , IsAddressSelected () ? m_max_addr_length : 0 , IsAddressSelected () ? " address" : " " , IsVersionSelected () ? " version" : " " );
515
528
for (const Peer& peer : m_peers) {
516
529
std::string version{ToString (peer.version ) + peer.sub_version };
517
530
result += strprintf (
518
- " %3s %6s %5s%7s%7s%5s%5s%5s%5s %2s %*s%*i %*s %-*s%s\n " ,
531
+ " %3s %6s %5s%7s%7s%5s%5s%5s%5s %2s %*s%*s%*s%* i %*s %-*s%s\n " ,
519
532
peer.is_outbound ? " out" : " in" ,
520
533
ConnectionTypeForNetinfo (peer.conn_type ),
521
534
peer.network ,
522
535
PingTimeToString (peer.min_ping ),
523
536
PingTimeToString (peer.ping ),
524
- peer.last_send == 0 ? " " : ToString (m_time_now - peer.last_send ),
525
- peer.last_recv == 0 ? " " : ToString (m_time_now - peer.last_recv ),
526
- peer.last_trxn == 0 ? " " : ToString ((m_time_now - peer.last_trxn ) / 60 ),
527
- peer.last_blck == 0 ? " " : ToString ((m_time_now - peer.last_blck ) / 60 ),
537
+ peer.last_send ? ToString (m_time_now - peer.last_send ) : " " ,
538
+ peer.last_recv ? ToString (m_time_now - peer.last_recv ) : " " ,
539
+ peer.last_trxn ? ToString ((m_time_now - peer.last_trxn ) / 60 ) : peer. is_block_relay ? " * " : " " ,
540
+ peer.last_blck ? ToString ((m_time_now - peer.last_blck ) / 60 ) : " " ,
528
541
strprintf (" %s%s" , peer.is_bip152_hb_to ? " ." : " " , peer.is_bip152_hb_from ? " *" : " " ),
542
+ m_max_addr_processed_length, // variable spacing
543
+ peer.addr_processed ? ToString (peer.addr_processed ) : peer.is_addr_relay_enabled ? " " : " ." ,
544
+ m_max_addr_rate_limited_length, // variable spacing
545
+ peer.addr_rate_limited ? ToString (peer.addr_rate_limited ) : " " ,
529
546
m_max_age_length, // variable spacing
530
547
peer.age ,
531
548
m_is_asmap_on ? 7 : 0 , // variable spacing
532
- m_is_asmap_on && peer.mapped_as != 0 ? ToString (peer.mapped_as ) : " " ,
549
+ m_is_asmap_on && peer.mapped_as ? ToString (peer.mapped_as ) : " " ,
533
550
m_max_id_length, // variable spacing
534
551
peer.id ,
535
552
IsAddressSelected () ? m_max_addr_length : 0 , // variable spacing
536
553
IsAddressSelected () ? peer.addr : " " ,
537
554
IsVersionSelected () && version != " 0" ? version : " " );
538
555
}
539
- result += strprintf (" ms ms sec sec min min %*s\n\n " , m_max_age_length, " min" );
556
+ result += strprintf (" ms ms sec sec min min %*s\n\n " , m_max_age_length, " min" );
540
557
}
541
558
542
559
// Report peer connection totals by type.
@@ -610,10 +627,14 @@ class NetinfoRequestHandler : public BaseRequestHandler
610
627
" send Time since last message sent to the peer, in seconds\n "
611
628
" recv Time since last message received from the peer, in seconds\n "
612
629
" txn Time since last novel transaction received from the peer and accepted into our mempool, in minutes\n "
630
+ " \" *\" - the peer requested we not relay transactions to it (relaytxes is false)\n "
613
631
" blk Time since last novel block passing initial validity checks received from the peer, in minutes\n "
614
632
" hb High-bandwidth BIP152 compact block relay\n "
615
633
" \" .\" (to) - we selected the peer as a high-bandwidth peer\n "
616
634
" \" *\" (from) - the peer selected us as a high-bandwidth peer\n "
635
+ " addrp Total number of addresses processed, excluding those dropped due to rate limiting\n "
636
+ " \" .\" - we do not relay addresses to this peer (addr_relay_enabled is false)\n "
637
+ " addrl Total number of addresses dropped due to rate limiting\n "
617
638
" age Duration of connection to the peer, in minutes\n "
618
639
" asmap Mapped AS (Autonomous System) number in the BGP route to the peer, used for diversifying\n "
619
640
" peer selection (only displayed if the -asmap config option is set)\n "
0 commit comments