@@ -401,7 +401,7 @@ class NetinfoRequestHandler : public BaseRequestHandler
401
401
bool IsVersionSelected () const { return m_details_level == 3 || m_details_level == 4 ; }
402
402
bool m_is_asmap_on{false };
403
403
size_t m_max_addr_length{0 };
404
- size_t m_max_age_length{4 };
404
+ size_t m_max_age_length{3 };
405
405
size_t m_max_id_length{2 };
406
406
struct Peer {
407
407
std::string addr;
@@ -418,6 +418,8 @@ class NetinfoRequestHandler : public BaseRequestHandler
418
418
int id;
419
419
int mapped_as;
420
420
int version;
421
+ bool is_bip152_hb_from;
422
+ bool is_bip152_hb_to;
421
423
bool is_block_relay;
422
424
bool is_outbound;
423
425
bool operator <(const Peer& rhs) const { return std::tie (is_outbound, min_ping) < std::tie (rhs.is_outbound , rhs.min_ping ); }
@@ -506,7 +508,9 @@ class NetinfoRequestHandler : public BaseRequestHandler
506
508
const std::string addr{peer[" addr" ].get_str ()};
507
509
const std::string age{conn_time == 0 ? " " : ToString ((m_time_now - conn_time) / 60 )};
508
510
const std::string sub_version{peer[" subver" ].get_str ()};
509
- 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_block_relay, is_outbound});
511
+ const bool is_bip152_hb_from{peer[" bip152_hb_from" ].get_bool ()};
512
+ const bool is_bip152_hb_to{peer[" bip152_hb_to" ].get_bool ()};
513
+ 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});
510
514
m_max_addr_length = std::max (addr.length () + 1 , m_max_addr_length);
511
515
m_max_age_length = std::max (age.length (), m_max_age_length);
512
516
m_max_id_length = std::max (ToString (peer_id).length (), m_max_id_length);
@@ -520,13 +524,13 @@ class NetinfoRequestHandler : public BaseRequestHandler
520
524
// Report detailed peer connections list sorted by direction and minimum ping time.
521
525
if (DetailsRequested () && !m_peers.empty ()) {
522
526
std::sort (m_peers.begin (), m_peers.end ());
523
- result += strprintf (" <-> type net mping ping send recv txn blk %*s " , m_max_age_length, " age" );
527
+ result += strprintf (" <-> type net mping ping send recv txn blk hb %*s " , m_max_age_length, " age" );
524
528
if (m_is_asmap_on) result += " asmap " ;
525
529
result += strprintf (" %*s %-*s%s\n " , m_max_id_length, " id" , IsAddressSelected () ? m_max_addr_length : 0 , IsAddressSelected () ? " address" : " " , IsVersionSelected () ? " version" : " " );
526
530
for (const Peer& peer : m_peers) {
527
531
std::string version{ToString (peer.version ) + peer.sub_version };
528
532
result += strprintf (
529
- " %3s %6s %5s%7s%7s%5s%5s%5s%5s %*s%*i %*s %-*s%s\n " ,
533
+ " %3s %6s %5s%7s%7s%5s%5s%5s%5s %2s %*s%*i %*s %-*s%s\n " ,
530
534
peer.is_outbound ? " out" : " in" ,
531
535
ConnectionTypeForNetinfo (peer.conn_type ),
532
536
peer.network ,
@@ -536,6 +540,7 @@ class NetinfoRequestHandler : public BaseRequestHandler
536
540
peer.last_recv == 0 ? " " : ToString (m_time_now - peer.last_recv ),
537
541
peer.last_trxn == 0 ? " " : ToString ((m_time_now - peer.last_trxn ) / 60 ),
538
542
peer.last_blck == 0 ? " " : ToString ((m_time_now - peer.last_blck ) / 60 ),
543
+ strprintf (" %s%s" , peer.is_bip152_hb_to ? " ." : " " , peer.is_bip152_hb_from ? " *" : " " ),
539
544
m_max_age_length, // variable spacing
540
545
peer.age ,
541
546
m_is_asmap_on ? 7 : 0 , // variable spacing
@@ -546,7 +551,7 @@ class NetinfoRequestHandler : public BaseRequestHandler
546
551
IsAddressSelected () ? peer.addr : " " ,
547
552
IsVersionSelected () && version != " 0" ? version : " " );
548
553
}
549
- 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" );
550
555
}
551
556
552
557
// Report peer connection totals by type.
@@ -632,6 +637,9 @@ class NetinfoRequestHandler : public BaseRequestHandler
632
637
" recv Time since last message received from the peer, in seconds\n "
633
638
" txn Time since last novel transaction received from the peer and accepted into our mempool, in minutes\n "
634
639
" blk Time since last novel block passing initial validity checks received from the peer, in minutes\n "
640
+ " hb High-bandwidth BIP152 compact block relay\n "
641
+ " \" .\" (to) - we selected the peer as a high-bandwidth peer\n "
642
+ " \" *\" (from) - the peer selected us as a high-bandwidth peer\n "
635
643
" age Duration of connection to the peer, in minutes\n "
636
644
" asmap Mapped AS (Autonomous System) number in the BGP route to the peer, used for diversifying\n "
637
645
" peer selection (only displayed if the -asmap config option is set)\n "
0 commit comments