Revert deadlock fix in ProcessGetData

Fix was introdeced in:
https://github.com/dashpay/dash/pull/1169
A fix was later applied to fix a race condition:
https://github.com/dashpay/dash/pull/1178

This has to be reverted to be able to backport multiple changes from Bitcoin.
Later backported PRs from Bitcoin will remove cs_mapRelay and thus also
remove the deadlock that was initially fixed with the above PRs.
This commit is contained in:
Alexander Block 2017-09-15 23:09:12 +02:00
parent d8c5a59005
commit 2dc71e8e08

View File

@ -885,17 +885,12 @@ void static ProcessGetData(CNode* pfrom, const Consensus::Params& consensusParam
// Send stream from relay memory
bool pushed = false;
{
CDataStream ss(SER_NETWORK, PROTOCOL_VERSION);
{
LOCK(cs_mapRelay);
map<CInv, CDataStream>::iterator mi = mapRelay.find(inv);
if (mi != mapRelay.end()) {
ss += (*mi).second;
pushed = true;
}
LOCK(cs_mapRelay);
map<CInv, CDataStream>::iterator mi = mapRelay.find(inv);
if (mi != mapRelay.end()) {
pfrom->PushMessage(inv.GetCommand(), (*mi).second);
pushed = true;
}
if(pushed)
connman.PushMessage(pfrom, inv.GetCommand(), ss);
}
if (!pushed && inv.type == MSG_TX) {