Browse Source

AlreadyHave(): only hold lock during mapTransactions access

0.8
Jeff Garzik 13 years ago committed by Jeff Garzik
parent
commit
8bff8ac079
  1. 6
      src/main.cpp

6
src/main.cpp

@ -2136,9 +2136,13 @@ bool static AlreadyHave(CTxDB& txdb, const CInv& inv) @@ -2136,9 +2136,13 @@ bool static AlreadyHave(CTxDB& txdb, const CInv& inv)
switch (inv.type)
{
case MSG_TX:
{
bool txInMap = false;
{
LOCK(cs_mapTransactions);
return mapTransactions.count(inv.hash) ||
txInMap = (mapTransactions.count(inv.hash) != 0);
}
return txInMap ||
mapOrphanTransactions.count(inv.hash) ||
txdb.ContainsTx(inv.hash);
}

Loading…
Cancel
Save