When count is 0 and addr_infos.push(addr_info);(on line 69) has already been executed, checking if addr_infos.len() == count will definitely return false. At this point, it will continue executing all of self.random_ids before returning. I believe that in this case, when count is 0, it should immediately return an empty Vec.
Use fuzz to test some code of the network. Found a bug: AddrManager::fetch_random
When
count
is 0 andaddr_infos.push(addr_info);
(on line 69) has already been executed, checkingif addr_infos.len() == count
will definitely return false. At this point, it will continue executing all ofself.random_ids
before returning. I believe that in this case, whencount
is 0, it should immediately return an emptyVec
.