@@ -189,7 +189,7 @@ impl HbbftPeersManagement {
189189
190190 // validators_to_remove
191191 let mut current_validator_connections: Vec < ValidatorConnectionData > = Vec :: new ( ) ;
192- let mut validators_to_connect : Vec < ValidatorConnectionData > = Vec :: new ( ) ;
192+ let mut validators_to_connect_count = 0 ;
193193 for node in validator_set. iter ( ) {
194194 let address = public_key_to_address ( & node. 0 ) ;
195195
@@ -204,7 +204,7 @@ impl HbbftPeersManagement {
204204 self . connect_to_validator ( client, block_chain_client, & address)
205205 {
206206 validators_to_remove. remove ( & connection. mining_address ) ;
207- validators_to_connect . push ( connection . clone ( ) ) ;
207+ validators_to_connect_count += 1 ;
208208 current_validator_connections. push ( connection) ;
209209 } else {
210210 warn ! ( target: "Engine" , "could not add current validator to reserved peers: {}" , address) ;
@@ -246,8 +246,8 @@ impl HbbftPeersManagement {
246246 // and we have disconnected all previous validators that are not current validators anymore.
247247 // so we now can set the information of collected validators.
248248
249- if validators_to_connect . len ( ) > 0 {
250- info ! ( target: "Engine" , "added {} current validators as reserved peers." , validators_to_connect . len ( ) ) ;
249+ if validators_to_connect_count > 0 {
250+ info ! ( target: "Engine" , "added {} current validators as reserved peers." , validators_to_connect_count ) ;
251251 }
252252
253253 self . connected_current_validators = current_validator_connections;
0 commit comments