Browse Source

Remove mempool p2p message #284

pull/332/head
Duke 1 year ago
parent
commit
15aaf4af44
  1. 25
      src/main.cpp
  2. 2
      src/protocol.cpp
  3. 6
      src/protocol.h

25
src/main.cpp

@ -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

2
src/protocol.cpp

@ -51,7 +51,6 @@ const char *TX="tx"; //used
const char *HEADERS="headers"; //used
const char *BLOCK="block"; //used
const char *GETADDR="getaddr"; //used
const char *MEMPOOL="mempool"; //used
const char *PING="ping"; //used
const char *PONG="pong"; //used
const char *NOTFOUND="notfound"; //used
@ -96,7 +95,6 @@ const static std::string allNetMessageTypes[] = {
NetMsgType::HEADERS,
NetMsgType::BLOCK,
NetMsgType::GETADDR,
NetMsgType::MEMPOOL,
NetMsgType::PING,
NetMsgType::PONG,
NetMsgType::NOTFOUND,

6
src/protocol.h

@ -158,12 +158,6 @@ extern const char* BLOCK;
* preferably one with lots of IP addresses of other receiving nodes.
*/
extern const char* GETADDR;
/**
* The mempool message requests the TXIDs of transactions that the receiving
* node has verified as valid but which have not yet appeared in a block.
* @since protocol version 60002.
*/
extern const char* MEMPOOL;
/**
* The ping message is sent periodically to help confirm that the receiving
* peer is still connected.

Loading…
Cancel
Save