mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-03-24 06:30:10 +01:00
[refactor] Add helper for retrieving mempool entry
In places where the iterator is only needed for accessing the actual entry, it should not be required to first retrieve the iterator.
This commit is contained in:
@@ -862,6 +862,13 @@ std::vector<TxMempoolInfo> CTxMemPool::infoAll() const
|
||||
return ret;
|
||||
}
|
||||
|
||||
const CTxMemPoolEntry* CTxMemPool::GetEntry(const Txid& txid) const
|
||||
{
|
||||
AssertLockHeld(cs);
|
||||
const auto i = mapTx.find(txid);
|
||||
return i == mapTx.end() ? nullptr : &(*i);
|
||||
}
|
||||
|
||||
CTransactionRef CTxMemPool::get(const uint256& hash) const
|
||||
{
|
||||
LOCK(cs);
|
||||
|
||||
Reference in New Issue
Block a user