Browse Source

Anti p2p fingerprinting via nTime

duke
Duke Leto 3 years ago
parent
commit
2ea5dcb048
  1. 1
      src/main.cpp
  2. 6
      src/net.cpp

1
src/main.cpp

@ -6979,6 +6979,7 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv,
BOOST_FOREACH(CAddress& addr, vAddr) BOOST_FOREACH(CAddress& addr, vAddr)
{ {
boost::this_thread::interruption_point(); 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) if (addr.nTime <= 100000000 || addr.nTime > nNow + 10 * 60)
addr.nTime = nNow - 5 * 24 * 60 * 60; addr.nTime = nNow - 5 * 24 * 60 * 60;

6
src/net.cpp

@ -1,6 +1,6 @@
// Copyright (c) 2009-2010 Satoshi Nakamoto // Copyright (c) 2009-2010 Satoshi Nakamoto
// Copyright (c) 2009-2014 The Bitcoin Core developers // 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 // Distributed under the GPLv3 software license, see the accompanying
// file COPYING or https://www.gnu.org/licenses/gpl-3.0.en.html // 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); ret = CAddress(addr);
} }
//TODO: option to set custom services
ret.nServices = nLocalServices; ret.nServices = nLocalServices;
ret.nTime = GetTime(); // Round to the nearest 5 min window to avoid fingerprinting -- Duke
ret.nTime = GetTime() - (GetTime() % 300);
return ret; return ret;
} }

Loading…
Cancel
Save