git://git.novaco.in
/
novacoin.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
(parent:
dd21ce5
)
AlreadyHave(): only hold lock during mapTransactions access
author
Jeff Garzik
<jeff@garzik.org>
Tue, 17 Apr 2012 16:30:00 +0000 (12:30 -0400)
committer
Jeff Garzik
<jgarzik@redhat.com>
Tue, 17 Apr 2012 16:30:00 +0000 (12:30 -0400)
src/main.cpp
patch
|
blob
|
history
diff --git
a/src/main.cpp
b/src/main.cpp
index
449f4bd
..
5b5062c
100644
(file)
--- 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);
}