mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-05-10 11:50:55 +02:00
ProcessOrphanTx: remove useless done variable
There is a keyword that allows us to break out of loops. Use it. There's a small change in behaviour here: if we process multiple orphans that are still orphans, then we'll only call mempool.check() once at the end, instead of after processing each tx.
This commit is contained in:
parent
6e8dd99ef1
commit
55c79a9cef
@ -2049,8 +2049,8 @@ void PeerManager::ProcessOrphanTx(std::set<uint256>& orphan_work_set, std::list<
|
|||||||
AssertLockHeld(cs_main);
|
AssertLockHeld(cs_main);
|
||||||
AssertLockHeld(g_cs_orphans);
|
AssertLockHeld(g_cs_orphans);
|
||||||
std::set<NodeId> setMisbehaving;
|
std::set<NodeId> setMisbehaving;
|
||||||
bool done = false;
|
|
||||||
while (!done && !orphan_work_set.empty()) {
|
while (!orphan_work_set.empty()) {
|
||||||
const uint256 orphanHash = *orphan_work_set.begin();
|
const uint256 orphanHash = *orphan_work_set.begin();
|
||||||
orphan_work_set.erase(orphan_work_set.begin());
|
orphan_work_set.erase(orphan_work_set.begin());
|
||||||
|
|
||||||
@ -2078,7 +2078,7 @@ void PeerManager::ProcessOrphanTx(std::set<uint256>& orphan_work_set, std::list<
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
EraseOrphanTx(orphanHash);
|
EraseOrphanTx(orphanHash);
|
||||||
done = true;
|
break;
|
||||||
} else if (orphan_state.GetResult() != TxValidationResult::TX_MISSING_INPUTS) {
|
} else if (orphan_state.GetResult() != TxValidationResult::TX_MISSING_INPUTS) {
|
||||||
if (orphan_state.IsInvalid()) {
|
if (orphan_state.IsInvalid()) {
|
||||||
// Punish peer that gave us an invalid orphan tx
|
// Punish peer that gave us an invalid orphan tx
|
||||||
@ -2124,10 +2124,10 @@ void PeerManager::ProcessOrphanTx(std::set<uint256>& orphan_work_set, std::list<
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
EraseOrphanTx(orphanHash);
|
EraseOrphanTx(orphanHash);
|
||||||
done = true;
|
break;
|
||||||
}
|
}
|
||||||
m_mempool.check(&::ChainstateActive().CoinsTip());
|
|
||||||
}
|
}
|
||||||
|
m_mempool.check(&::ChainstateActive().CoinsTip());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
x
Reference in New Issue
Block a user