|
|
@ -7672,31 +7672,6 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv, |
|
|
|
Misbehaving(pfrom->GetId(), nDoS); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
} else if (strCommand == NetMsgType::MEMPOOL) { |
|
|
|
LOCK2(cs_main, pfrom->cs_filter); |
|
|
|
//LogPrintf("%s: mempool request from %s",__func__, pfrom->addr.ToString().c_str());
|
|
|
|
// TODO: limit mempool requests per time and per peer
|
|
|
|
|
|
|
|
std::vector<uint256> vtxid; |
|
|
|
mempool.queryHashes(vtxid); |
|
|
|
vector<CInv> vInv; |
|
|
|
BOOST_FOREACH(uint256& hash, vtxid) { |
|
|
|
CInv inv(MSG_TX, hash); |
|
|
|
if (pfrom->pfilter) { |
|
|
|
CTransaction tx; |
|
|
|
bool fInMemPool = mempool.lookup(hash, tx); |
|
|
|
if (!fInMemPool) continue; // another thread removed since queryHashes, maybe...
|
|
|
|
if (!pfrom->pfilter->IsRelevantAndUpdate(tx)) continue; |
|
|
|
} |
|
|
|
vInv.push_back(inv); |
|
|
|
if (vInv.size() == MAX_INV_SZ) { |
|
|
|
pfrom->PushMessage(NetMsgType::INV, vInv); |
|
|
|
vInv.clear(); |
|
|
|
} |
|
|
|
} |
|
|
|
if (vInv.size() > 0) |
|
|
|
pfrom->PushMessage(NetMsgType::INV, vInv); |
|
|
|
} else if (strCommand == NetMsgType::ALERT) { |
|
|
|
// Small DoS penalty so peers that send us lots of
|
|
|
|
// duplicate/expired/invalid-signature/whatever alerts
|
|
|
|