Seed debug outputs cleanup (#460)

* DRY up

* iterate 66% less

* clarify debug! outputs

* less verbose peer queuing

Rationale: debug outputs that happen _a lot_ is nice if they're short and distinct, making them easier to pattern match / willfully ignore while reading through logs

* update comment to mention last weeks' added usecases

* .push() less
This commit is contained in:
Simon B
2017-12-11 15:38:46 +01:00
committed by AntiochP
parent 18fc1384de
commit 8b81a2f806
2 changed files with 19 additions and 26 deletions
+5 -8
View File
@@ -122,15 +122,12 @@ impl PeerStore {
peers.iter().take(count).cloned().collect()
}
/// List all known peers (for the /v1/peers api endpoint)
/// List all known peers
/// Used for /v1/peers, for seed / sync (debug & if too few peers connected)
pub fn all_peers(&self) -> Vec<PeerData> {
let peers_iter = self.db
.iter::<PeerData>(&to_key(PEER_PREFIX, &mut "".to_string().into_bytes()));
let mut peers = vec![];
for p in peers_iter {
peers.push(p);
}
peers
self.db
.iter::<PeerData>(&to_key(PEER_PREFIX, &mut "".to_string().into_bytes()))
.collect::<Vec<_>>()
}
/// Convenience method to load a peer data, update its status and save it