From: Jeff Garzik Date: Tue, 17 Apr 2012 16:30:00 +0000 (-0400) Subject: AlreadyHave(): only hold lock during mapTransactions access X-Git-Tag: v0.4.0-unstable~129^2~66 X-Git-Url: https://git.novaco.in/?p=novacoin.git;a=commitdiff_plain;h=8bff8ac079cd79757c398cf61ab29d62fe4e2d65 AlreadyHave(): only hold lock during mapTransactions access --- diff --git a/src/main.cpp b/src/main.cpp index 449f4bd..5b5062c 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -2137,8 +2137,12 @@ bool static AlreadyHave(CTxDB& txdb, const CInv& inv) { case MSG_TX: { - LOCK(cs_mapTransactions); - return mapTransactions.count(inv.hash) || + bool txInMap = false; + { + LOCK(cs_mapTransactions); + txInMap = (mapTransactions.count(inv.hash) != 0); + } + return txInMap || mapOrphanTransactions.count(inv.hash) || txdb.ContainsTx(inv.hash); }