Merge pull request #1094 from jgarzik/already-have-locking
Locking fix for AlreadyHave()
This commit is contained in:
commit
dd21ce5f1b
1 changed files with 11 additions and 2 deletions
13
src/main.cpp
13
src/main.cpp
|
@ -2135,8 +2135,17 @@ 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_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;
|
||||
|
|
Loading…
Reference in a new issue