mirror of
https://github.com/mimblewimble/grin.git
synced 2025-01-21 03:21:08 +03:00
Preventing save of loopback IPs, fix #236
This commit is contained in:
parent
15705b3fa1
commit
8f78b74d67
1 changed files with 10 additions and 5 deletions
|
@ -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,
|
||||
|
|
Loading…
Reference in a new issue