mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-11-11 14:38:29 +01:00
Defer inserting into maprelay until just before relaying.
This reduces the rate of not founds by better matching the far end expectations, it also improves privacy by removing the ability to use getdata to probe for a node having a txn before it has been relayed.
This commit is contained in:
15
src/net.cpp
15
src/net.cpp
@@ -90,9 +90,6 @@ std::string strSubVersion;
|
||||
|
||||
std::vector<CNode*> vNodes;
|
||||
CCriticalSection cs_vNodes;
|
||||
std::map<uint256, CTransaction> mapRelay;
|
||||
std::deque<std::pair<int64_t, uint256> > vRelayExpiration;
|
||||
CCriticalSection cs_mapRelay;
|
||||
limitedmap<uint256, int64_t> mapAlreadyAskedFor(MAX_INV_SZ);
|
||||
|
||||
static std::deque<std::string> vOneShots;
|
||||
@@ -2081,18 +2078,6 @@ instance_of_cnetcleanup;
|
||||
void RelayTransaction(const CTransaction& tx)
|
||||
{
|
||||
CInv inv(MSG_TX, tx.GetHash());
|
||||
{
|
||||
LOCK(cs_mapRelay);
|
||||
// Expire old relay messages
|
||||
while (!vRelayExpiration.empty() && vRelayExpiration.front().first < GetTime())
|
||||
{
|
||||
mapRelay.erase(vRelayExpiration.front().second);
|
||||
vRelayExpiration.pop_front();
|
||||
}
|
||||
|
||||
mapRelay.insert(std::make_pair(inv.hash, tx));
|
||||
vRelayExpiration.push_back(std::make_pair(GetTime() + 15 * 60, inv.hash));
|
||||
}
|
||||
LOCK(cs_vNodes);
|
||||
BOOST_FOREACH(CNode* pnode, vNodes)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user