From 2dc71e8e089579ddba3513043d654a3df536694c Mon Sep 17 00:00:00 2001 From: Alexander Block Date: Fri, 15 Sep 2017 23:09:12 +0200 Subject: [PATCH] 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. --- src/net_processing.cpp | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/src/net_processing.cpp b/src/net_processing.cpp index da219d8663..82cccadf64 100644 --- a/src/net_processing.cpp +++ b/src/net_processing.cpp @@ -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::iterator mi = mapRelay.find(inv); - if (mi != mapRelay.end()) { - ss += (*mi).second; - pushed = true; - } + LOCK(cs_mapRelay); + map::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) {