Preventing save of loopback IPs, fix
@@ -94,6 +94,11 @@ impl PeerStore {
}
pub fn save_peer(&self, p: &PeerData) -> Result<(), Error> {
+ // we want to ignore any peer without a well-defined ip
+ let ip = p.addr.ip();
+ if ip.is_unspecified() || ip.is_loopback() {
+ return Ok(());
+ }
self.db.put_ser(
&to_key(PEER_PREFIX, &mut format!("{}", p.addr).into_bytes())[..],
p,
