mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-06-04 10:12:28 +02:00
AlreadyHave(): only hold lock during mapTransactions access
This commit is contained in:
10
src/main.cpp
10
src/main.cpp
@@ -1954,11 +1954,15 @@ bool static AlreadyHave(CTxDB& txdb, const CInv& inv)
|
||||
switch (inv.type)
|
||||
{
|
||||
case MSG_TX:
|
||||
{
|
||||
bool txInMap = false;
|
||||
CRITICAL_BLOCK(cs_mapTransactions)
|
||||
{
|
||||
return mapTransactions.count(inv.hash) ||
|
||||
mapOrphanTransactions.count(inv.hash) ||
|
||||
txdb.ContainsTx(inv.hash);
|
||||
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);
|
||||
|
||||
Reference in New Issue
Block a user