mirror of
https://github.com/dashpay/dash.git
synced 2024-12-26 20:42:59 +01:00
parent
2189570911
commit
f7e9bc613a
@ -899,10 +899,16 @@ void static ProcessGetData(CNode* pfrom, const Consensus::Params& consensusParam
|
|||||||
connman.PushMessage(pfrom, NetMsgType::BLOCK, block);
|
connman.PushMessage(pfrom, NetMsgType::BLOCK, block);
|
||||||
else // MSG_FILTERED_BLOCK)
|
else // MSG_FILTERED_BLOCK)
|
||||||
{
|
{
|
||||||
LOCK(pfrom->cs_filter);
|
bool send = false;
|
||||||
if (pfrom->pfilter)
|
CMerkleBlock merkleBlock;
|
||||||
{
|
{
|
||||||
CMerkleBlock merkleBlock(block, *pfrom->pfilter);
|
LOCK(pfrom->cs_filter);
|
||||||
|
if (pfrom->pfilter) {
|
||||||
|
send = true;
|
||||||
|
merkleBlock = CMerkleBlock(block, *pfrom->pfilter);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (send) {
|
||||||
connman.PushMessage(pfrom, NetMsgType::MERKLEBLOCK, merkleBlock);
|
connman.PushMessage(pfrom, NetMsgType::MERKLEBLOCK, merkleBlock);
|
||||||
// CMerkleBlock just contains hashes, so also push any transactions in the block the client did not see
|
// CMerkleBlock just contains hashes, so also push any transactions in the block the client did not see
|
||||||
// This avoids hurting performance by pointlessly requiring a round-trip
|
// This avoids hurting performance by pointlessly requiring a round-trip
|
||||||
@ -2144,8 +2150,6 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv,
|
|||||||
CBloomFilter filter;
|
CBloomFilter filter;
|
||||||
vRecv >> filter;
|
vRecv >> filter;
|
||||||
|
|
||||||
LOCK(pfrom->cs_filter);
|
|
||||||
|
|
||||||
if (!filter.IsWithinSizeConstraints())
|
if (!filter.IsWithinSizeConstraints())
|
||||||
{
|
{
|
||||||
// There is no excuse for sending a too-large filter
|
// There is no excuse for sending a too-large filter
|
||||||
@ -2154,11 +2158,12 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv,
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
LOCK(pfrom->cs_filter);
|
||||||
delete pfrom->pfilter;
|
delete pfrom->pfilter;
|
||||||
pfrom->pfilter = new CBloomFilter(filter);
|
pfrom->pfilter = new CBloomFilter(filter);
|
||||||
pfrom->pfilter->UpdateEmptyFull();
|
pfrom->pfilter->UpdateEmptyFull();
|
||||||
|
pfrom->fRelayTxes = true;
|
||||||
}
|
}
|
||||||
pfrom->fRelayTxes = true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -2169,20 +2174,21 @@ bool static ProcessMessage(CNode* pfrom, string strCommand, CDataStream& vRecv,
|
|||||||
|
|
||||||
// Nodes must NEVER send a data item > 520 bytes (the max size for a script data object,
|
// Nodes must NEVER send a data item > 520 bytes (the max size for a script data object,
|
||||||
// and thus, the maximum size any matched object can have) in a filteradd message
|
// and thus, the maximum size any matched object can have) in a filteradd message
|
||||||
if (vData.size() > MAX_SCRIPT_ELEMENT_SIZE)
|
bool bad = false;
|
||||||
{
|
if (vData.size() > MAX_SCRIPT_ELEMENT_SIZE) {
|
||||||
LOCK(cs_main);
|
bad = true;
|
||||||
Misbehaving(pfrom->GetId(), 100);
|
|
||||||
} else {
|
} else {
|
||||||
LOCK(pfrom->cs_filter);
|
LOCK(pfrom->cs_filter);
|
||||||
if (pfrom->pfilter)
|
if (pfrom->pfilter) {
|
||||||
pfrom->pfilter->insert(vData);
|
pfrom->pfilter->insert(vData);
|
||||||
else
|
} else {
|
||||||
{
|
bad = true;
|
||||||
LOCK(cs_main);
|
|
||||||
Misbehaving(pfrom->GetId(), 100);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (bad) {
|
||||||
|
LOCK(cs_main);
|
||||||
|
Misbehaving(pfrom->GetId(), 100);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user