Mercurial > hg > bitcoin
changeset 2269:3a7cadc1b470 draft
Merge pull request #1094 from jgarzik/already-have-locking
Locking fix for AlreadyHave()
author | Jeff Garzik <jgarzik@exmulti.com> |
---|---|
date | Tue, 17 Apr 2012 09:23:49 -0700 |
parents | 876e04b9f768 (current diff) 769fdad63e31 (diff) |
children | 46a8109ef2c6 |
files | src/main.cpp |
diffstat | 1 files changed, 11 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/src/main.cpp +++ b/src/main.cpp @@ -2135,8 +2135,17 @@ { switch (inv.type) { - case MSG_TX: return mapTransactions.count(inv.hash) || mapOrphanTransactions.count(inv.hash) || txdb.ContainsTx(inv.hash); - case MSG_BLOCK: return mapBlockIndex.count(inv.hash) || mapOrphanBlocks.count(inv.hash); + case MSG_TX: + { + LOCK(cs_mapTransactions); + return mapTransactions.count(inv.hash) || + 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 return true;