Changeset View
Changeset View
Standalone View
Standalone View
src/txmempool.cpp
Show First 20 Lines • Show All 924 Lines • ▼ Show 20 Lines | std::vector<TxMempoolInfo> CTxMemPool::infoAll() const { | ||||
ret.reserve(mapTx.size()); | ret.reserve(mapTx.size()); | ||||
for (auto it : iters) { | for (auto it : iters) { | ||||
ret.push_back(GetInfo(it)); | ret.push_back(GetInfo(it)); | ||||
} | } | ||||
return ret; | return ret; | ||||
} | } | ||||
std::vector<CTransactionRef> CTxMemPool::takeAll() { | |||||
std::vector<CTransactionRef> ret; | |||||
LOCK(cs); | |||||
ret.reserve(mapTx.size()); | |||||
for (indexed_transaction_set::const_iterator it = mapTx.begin(); | |||||
it != mapTx.end(); it++) { | |||||
ret.push_back(it->GetSharedTx()); | |||||
} | |||||
_clear(); | |||||
return ret; | |||||
} | |||||
CTransactionRef CTxMemPool::get(const uint256 &txid) const { | CTransactionRef CTxMemPool::get(const uint256 &txid) const { | ||||
LOCK(cs); | LOCK(cs); | ||||
indexed_transaction_set::const_iterator i = mapTx.find(txid); | indexed_transaction_set::const_iterator i = mapTx.find(txid); | ||||
if (i == mapTx.end()) { | if (i == mapTx.end()) { | ||||
return nullptr; | return nullptr; | ||||
} | } | ||||
return i->GetSharedTx(); | return i->GetSharedTx(); | ||||
▲ Show 20 Lines • Show All 428 Lines • Show Last 20 Lines |