Skip to content

Commit e4c57fb

Browse files
committed
address nit from review
1 parent d490270 commit e4c57fb

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

stackslib/src/net/api/gethealth.rs

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -104,16 +104,17 @@ impl RPCRequestHandler for RPCGetHealthRequestHandler {
104104
_contents: HttpRequestContents,
105105
node: &mut StacksNodeState,
106106
) -> Result<(HttpResponsePreamble, HttpResponseContents), NetError> {
107-
let (max_stacks_height_of_neighbors, node_stacks_tip_height) =
107+
let ((max_stacks_neighbor_address, max_stacks_height_of_neighbors), node_stacks_tip_height) =
108108
node.with_node_state(|network, _sortdb, _chainstate, _mempool, _rpc_args| {
109-
(network.highest_stacks_neighbor, network.stacks_tip.height)
109+
(
110+
network
111+
.highest_stacks_neighbor
112+
.map(|(addr, height)| (Some(addr.to_string()), height))
113+
.unwrap_or((None, 0)),
114+
network.stacks_tip.height,
115+
)
110116
});
111117

112-
let (max_stacks_neighbor_address, max_stacks_height_of_neighbors) =
113-
match max_stacks_height_of_neighbors {
114-
Some((addr, height)) => (Some(addr.to_string()), height),
115-
None => (None, 0),
116-
};
117118
// There could be a edge case where our node is ahead of all peers.
118119
let difference_from_max_peer =
119120
max_stacks_height_of_neighbors.saturating_sub(node_stacks_tip_height);

0 commit comments

Comments
 (0)