MCPcopy Create free account
hub / github.com/WaykiChain/WaykiChain / ProcessMempoolMessage

Function ProcessMempoolMessage

src/p2p/chainmessage.cpp:729–751  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

727}
728
729void ProcessMempoolMessage(CNode *pFrom, CDataStream &vRecv) {
730 LOCK2(cs_main, pFrom->cs_filter);
731
732 vector<uint256> vtxid;
733 mempool.QueryHash(vtxid);
734 vector<CInv> vInv;
735 for (auto &hash : vtxid) {
736 CInv inv(MSG_TX, hash);
737 std::shared_ptr<CBaseTx> pBaseTx = mempool.Lookup(hash);
738 if (pBaseTx.get())
739 continue; // another thread removed since queryHashes, maybe...
740
741 if ((pFrom->pFilter && pFrom->pFilter->contains(hash)) || // other type transaction
742 (!pFrom->pFilter))
743 vInv.push_back(inv);
744
745 if (vInv.size() == MAX_INV_SZ) {
746 pFrom->PushMessage(NetMsgType::INV, vInv);
747 vInv.clear();
748 }
749 }
750 if (vInv.size() > 0) pFrom->PushMessage(NetMsgType::INV, vInv);
751}
752
753void ProcessAlertMessage(CNode *pFrom, CDataStream &vRecv) {
754 CAlert alert;

Callers 1

ProcessMessageFunction · 0.85

Calls 8

QueryHashMethod · 0.80
containsMethod · 0.80
push_backMethod · 0.80
PushMessageMethod · 0.80
LookupMethod · 0.45
getMethod · 0.45
sizeMethod · 0.45
clearMethod · 0.45

Tested by

no test coverage detected