aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorWladimir J. van der Laan <laanwj@gmail.com>2016-04-14 14:54:34 +0200
committerWladimir J. van der Laan <laanwj@gmail.com>2016-04-14 14:55:01 +0200
commit97d0b9889f151449656d6b575f4f864df0f91a80 (patch)
tree735b8c36054b5c3cd70b1a567849a1c73c92e397 /src
parentab8586e6677a3598e4c591dc53b52a5964ee1c15 (diff)
parent7e91f632c70ff1848a152f24ee67a06796803943 (diff)
Merge #7862: Use txid as key in mapAlreadyAskedFor
7e91f63 Use txid as key in mapAlreadyAskedFor (Suhas Daftuar)
Diffstat (limited to 'src')
-rw-r--r--src/main.cpp2
-rw-r--r--src/net.cpp6
-rw-r--r--src/net.h2
3 files changed, 5 insertions, 5 deletions
diff --git a/src/main.cpp b/src/main.cpp
index 9b164c7999..fff1cc346e 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -4955,7 +4955,7 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv,
CValidationState state;
pfrom->setAskFor.erase(inv.hash);
- mapAlreadyAskedFor.erase(inv);
+ mapAlreadyAskedFor.erase(inv.hash);
CFeeRate txFeeRate = CFeeRate(0);
if (!AlreadyHave(inv) && AcceptToMemoryPool(mempool, state, tx, true, &fMissingInputs, &txFeeRate)) {
diff --git a/src/net.cpp b/src/net.cpp
index e8cc753a48..3bf8c165dc 100644
--- a/src/net.cpp
+++ b/src/net.cpp
@@ -93,7 +93,7 @@ CCriticalSection cs_vNodes;
map<CInv, CDataStream> mapRelay;
deque<pair<int64_t, CInv> > vRelayExpiration;
CCriticalSection cs_mapRelay;
-limitedmap<CInv, int64_t> mapAlreadyAskedFor(MAX_INV_SZ);
+limitedmap<uint256, int64_t> mapAlreadyAskedFor(MAX_INV_SZ);
static deque<string> vOneShots;
CCriticalSection cs_vOneShots;
@@ -2436,7 +2436,7 @@ void CNode::AskFor(const CInv& inv)
// We're using mapAskFor as a priority queue,
// the key is the earliest time the request can be sent
int64_t nRequestTime;
- limitedmap<CInv, int64_t>::const_iterator it = mapAlreadyAskedFor.find(inv);
+ limitedmap<uint256, int64_t>::const_iterator it = mapAlreadyAskedFor.find(inv.hash);
if (it != mapAlreadyAskedFor.end())
nRequestTime = it->second;
else
@@ -2455,7 +2455,7 @@ void CNode::AskFor(const CInv& inv)
if (it != mapAlreadyAskedFor.end())
mapAlreadyAskedFor.update(it, nRequestTime);
else
- mapAlreadyAskedFor.insert(std::make_pair(inv, nRequestTime));
+ mapAlreadyAskedFor.insert(std::make_pair(inv.hash, nRequestTime));
mapAskFor.insert(std::make_pair(nRequestTime, inv));
}
diff --git a/src/net.h b/src/net.h
index ab9eb68d85..1892c963fc 100644
--- a/src/net.h
+++ b/src/net.h
@@ -164,7 +164,7 @@ extern CCriticalSection cs_vNodes;
extern std::map<CInv, CDataStream> mapRelay;
extern std::deque<std::pair<int64_t, CInv> > vRelayExpiration;
extern CCriticalSection cs_mapRelay;
-extern limitedmap<CInv, int64_t> mapAlreadyAskedFor;
+extern limitedmap<uint256, int64_t> mapAlreadyAskedFor;
extern std::vector<std::string> vAddedNodes;
extern CCriticalSection cs_vAddedNodes;