Do not set an addr time penalty when a peer advertises itself.

Claims a peer makes about itself are inherently more credible.
This commit is contained in:
Gregory Maxwell 2016-09-03 10:24:37 +00:00
parent cbe9ae8c69
commit 6d0ced1865

View file

@ -255,6 +255,11 @@ bool CAddrMan::Add_(const CAddress& addr, const CNetAddr& source, int64_t nTimeP
int nId; int nId;
CAddrInfo* pinfo = Find(addr, &nId); CAddrInfo* pinfo = Find(addr, &nId);
// Do not set a penality for a source's self-announcement
if (addr == source) {
nTimePenalty = 0;
}
if (pinfo) { if (pinfo) {
// periodically update nTime // periodically update nTime
bool fCurrentlyOnline = (GetAdjustedTime() - addr.nTime < 24 * 60 * 60); bool fCurrentlyOnline = (GetAdjustedTime() - addr.nTime < 24 * 60 * 60);