Browse Source

AlreadyHave(): only hold lock during mapTransactions access

pull/1/head
Jeff Garzik 10 years ago committed by Jeff Garzik
parent
commit
8bff8ac079
  1. 8
      src/main.cpp

8
src/main.cpp

@ -2137,8 +2137,12 @@ bool static AlreadyHave(CTxDB& txdb, const CInv& inv) @@ -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);
}

Loading…
Cancel
Save