mirror of
https://github.com/dashpay/dash.git
synced 2024-12-25 12:02:48 +01:00
partial/logic backport #18544: net: limit BIP37 filter lifespan (active between 'filterload'..'filterclear') (#4043)
* partial backport 18544: net: limit BIP37 filter lifespan (active between 'filterload'..'filterclear') Previously, a default match-everything bloom filter was set for every peer, i.e. even before receiving a 'filterload' message and after receiving a 'filterclear' message code branches checking for the existence of the filter by testing the pointer "pfilter" were _always_ executed. * net: Match the backport PR a bit more Co-authored-by: xdustinface <xdustinfacex@gmail.com>
This commit is contained in:
parent
ea9daa762a
commit
bca9577b8f
@ -3913,7 +3913,6 @@ CNode::CNode(NodeId idIn, ServiceFlags nLocalServicesIn, int nMyStartingHeightIn
|
||||
nNextAddrSend = 0;
|
||||
fRelayTxes = false;
|
||||
fSentAddr = false;
|
||||
pfilter = MakeUnique<CBloomFilter>();
|
||||
timeLastMempoolReq = 0;
|
||||
nLastBlockTime = 0;
|
||||
nLastTXTime = 0;
|
||||
|
@ -900,7 +900,7 @@ public:
|
||||
bool m_masternode_iqr_connection{false};
|
||||
CSemaphoreGrant grantOutbound;
|
||||
CCriticalSection cs_filter;
|
||||
std::unique_ptr<CBloomFilter> pfilter PT_GUARDED_BY(cs_filter);
|
||||
std::unique_ptr<CBloomFilter> pfilter PT_GUARDED_BY(cs_filter){nullptr};
|
||||
std::atomic<int> nRefCount;
|
||||
|
||||
const uint64_t nKeyedNetGroup;
|
||||
|
@ -3493,7 +3493,7 @@ bool static ProcessMessage(CNode* pfrom, const std::string& strCommand, CDataStr
|
||||
if (strCommand == NetMsgType::FILTERCLEAR) {
|
||||
LOCK(pfrom->cs_filter);
|
||||
if (pfrom->GetLocalServices() & NODE_BLOOM) {
|
||||
pfrom->pfilter.reset(new CBloomFilter());
|
||||
pfrom->pfilter = nullptr;
|
||||
}
|
||||
pfrom->fRelayTxes = true;
|
||||
return true;
|
||||
|
Loading…
Reference in New Issue
Block a user