aboutsummaryrefslogtreecommitdiff
path: root/src/main.cpp
diff options
context:
space:
mode:
authorJeff Garzik <jeff@garzik.org>2012-04-17 12:30:00 -0400
committerJeff Garzik <jgarzik@redhat.com>2012-04-17 12:30:00 -0400
commit8bff8ac079cd79757c398cf61ab29d62fe4e2d65 (patch)
tree66b4bbdf5066da43ec24acf821f6cbc92bdfc3c5 /src/main.cpp
parentdd21ce5f1bb690e6104d8eba30cbd4b8749bf6b0 (diff)
AlreadyHave(): only hold lock during mapTransactions access
Diffstat (limited to 'src/main.cpp')
-rw-r--r--src/main.cpp8
1 files changed, 6 insertions, 2 deletions
diff --git a/src/main.cpp b/src/main.cpp
index 449f4bd372..5b5062cc05 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);
}