Anti p2p fingerprinting via nTime

This commit is contained in:
Duke Leto
2021-04-16 01:16:40 -04:00
parent e48ffbe455
commit 2ea5dcb048
2 changed files with 5 additions and 2 deletions

View File

@@ -6979,6 +6979,7 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv,
BOOST_FOREACH(CAddress& addr, vAddr)
{
boost::this_thread::interruption_point();
fprintf(stderr,"%s: %s.nTime=%d\n", __func__, pfrom->addr.ToString().c_str(), addr.nTime);
if (addr.nTime <= 100000000 || addr.nTime > nNow + 10 * 60)
addr.nTime = nNow - 5 * 24 * 60 * 60;

View File

@@ -1,6 +1,6 @@
// Copyright (c) 2009-2010 Satoshi Nakamoto
// Copyright (c) 2009-2014 The Bitcoin Core developers
// Copyright (c) 2016-2020 The Hush developers
// Copyright (c) 2016-2021 The Hush developers
// Distributed under the GPLv3 software license, see the accompanying
// file COPYING or https://www.gnu.org/licenses/gpl-3.0.en.html
/******************************************************************************
@@ -212,8 +212,10 @@ CAddress GetLocalAddress(const CNetAddr *paddrPeer)
{
ret = CAddress(addr);
}
//TODO: option to set custom services
ret.nServices = nLocalServices;
ret.nTime = GetTime();
// Round to the nearest 5 min window to avoid fingerprinting -- Duke
ret.nTime = GetTime() - (GetTime() % 300);
return ret;
}