Skip to content

Commit b0212c2

Browse files
committed
feat(rpc): Include more peer info
1 parent c6b4c4e commit b0212c2

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

node/src/rpc/mod.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,7 @@ pub enum ActionStatsResponse {
153153

154154
#[derive(Serialize, Deserialize, Debug, Clone)]
155155
pub enum PeerConnectionStatus {
156+
Disconnecting,
156157
Disconnected,
157158
Connecting,
158159
Connected,
@@ -168,6 +169,7 @@ pub struct RpcPeerInfo {
168169
pub connection_status: PeerConnectionStatus,
169170
pub address: Option<String>,
170171
pub incoming: bool,
172+
pub is_libp2p: bool,
171173
pub time: u64,
172174
}
173175

node/src/rpc/rpc_reducer.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -647,7 +647,7 @@ pub fn collect_rpc_peers_info(state: &crate::State) -> Vec<RpcPeerInfo> {
647647
}
648648
},
649649
p2p::P2pPeerStatus::Disconnecting { time } => {
650-
(PeerConnectionStatus::Disconnected, (*time).into(), false)
650+
(PeerConnectionStatus::Disconnecting, (*time).into(), false)
651651
}
652652
p2p::P2pPeerStatus::Disconnected { time } => {
653653
(PeerConnectionStatus::Disconnected, (*time).into(), false)
@@ -662,6 +662,7 @@ pub fn collect_rpc_peers_info(state: &crate::State) -> Vec<RpcPeerInfo> {
662662
peer_id: *peer_id,
663663
connection_status,
664664
address: state.dial_opts.as_ref().map(|opts| opts.to_string()),
665+
is_libp2p: state.is_libp2p,
665666
incoming,
666667
best_tip: best_tip.map(|bt| bt.hash.clone()),
667668
best_tip_height: best_tip.map(|bt| bt.height()),

0 commit comments

Comments
 (0)