@@ -104,16 +104,17 @@ impl RPCRequestHandler for RPCGetHealthRequestHandler {
104
104
_contents : HttpRequestContents ,
105
105
node : & mut StacksNodeState ,
106
106
) -> 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) =
108
108
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
+ )
110
116
} ) ;
111
117
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
- } ;
117
118
// There could be a edge case where our node is ahead of all peers.
118
119
let difference_from_max_peer =
119
120
max_stacks_height_of_neighbors. saturating_sub ( node_stacks_tip_height) ;
0 commit comments