aboutsummaryrefslogtreecommitdiff
path: root/src/main.cpp
diff options
context:
space:
mode:
authorLuke Dashjr <luke-jr+git@utopios.org>2012-04-22 10:07:24 -0400
committerLuke Dashjr <luke-jr+git@utopios.org>2012-04-22 10:07:24 -0400
commit66116c3847eeb3f0619bc084d96f5add41a156c8 (patch)
tree8952b665662e18fd4a1b6ffd5f99a39adab8d92d /src/main.cpp
parentc43a9ea77db06b9d101f0551df373d417e5028af (diff)
parenta93ab877877925c60b2dbf56bdde8aa46b6b7391 (diff)
downloadbitcoin-66116c3847eeb3f0619bc084d96f5add41a156c8.tar.xz
Merge branch '0.5.x' into 0.6.0.x
Conflicts: src/main.h src/net.cpp src/util.cpp
Diffstat (limited to 'src/main.cpp')
-rw-r--r--src/main.cpp15
1 files changed, 13 insertions, 2 deletions
diff --git a/src/main.cpp b/src/main.cpp
index e2310b8494..2473662620 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -2141,7 +2141,18 @@ bool static AlreadyHave(CTxDB& txdb, const CInv& inv)
{
switch (inv.type)
{
- case MSG_TX: return mapTransactions.count(inv.hash) || mapOrphanTransactions.count(inv.hash) || txdb.ContainsTx(inv.hash);
+ case MSG_TX:
+ {
+ bool txInMap = false;
+ CRITICAL_BLOCK(cs_mapTransactions)
+ {
+ txInMap = (mapTransactions.count(inv.hash) != 0);
+ }
+ return txInMap ||
+ mapOrphanTransactions.count(inv.hash) ||
+ txdb.ContainsTx(inv.hash);
+ }
+
case MSG_BLOCK: return mapBlockIndex.count(inv.hash) || mapOrphanBlocks.count(inv.hash);
}
// Don't know what it is, just say we already got one
@@ -2806,7 +2817,7 @@ bool ProcessMessages(CNode* pfrom)
bool SendMessages(CNode* pto, bool fSendTrickle)
{
- CRITICAL_BLOCK(cs_main)
+ TRY_CRITICAL_BLOCK(cs_main)
{
// Don't send anything until we get their version message
if (pto->nVersion == 0)