Changeset View
Changeset View
Standalone View
Standalone View
src/txmempool.cpp
Show First 20 Lines • Show All 865 Lines • ▼ Show 20 Lines | for (indexed_transaction_set::iterator mi = mapTx.begin(); | ||||
mi != mapTx.end(); ++mi) { | mi != mapTx.end(); ++mi) { | ||||
iters.push_back(mi); | iters.push_back(mi); | ||||
} | } | ||||
std::sort(iters.begin(), iters.end(), DepthAndScoreComparator()); | std::sort(iters.begin(), iters.end(), DepthAndScoreComparator()); | ||||
return iters; | return iters; | ||||
} | } | ||||
void CTxMemPool::queryHashes(std::vector<uint256> &vtxid) { | void CTxMemPool::queryHashes(std::vector<uint256> &vtxid) const { | ||||
LOCK(cs); | LOCK(cs); | ||||
auto iters = GetSortedDepthAndScore(); | auto iters = GetSortedDepthAndScore(); | ||||
vtxid.clear(); | vtxid.clear(); | ||||
vtxid.reserve(mapTx.size()); | vtxid.reserve(mapTx.size()); | ||||
for (auto it : iters) { | for (auto it : iters) { | ||||
vtxid.push_back(it->GetTx().GetId()); | vtxid.push_back(it->GetTx().GetId()); | ||||
▲ Show 20 Lines • Show All 350 Lines • ▼ Show 20 Lines | void CTxMemPool::GetTransactionAncestry(const uint256 &txid, size_t &ancestors, | ||||
auto it = mapTx.find(txid); | auto it = mapTx.find(txid); | ||||
ancestors = descendants = 0; | ancestors = descendants = 0; | ||||
if (it != mapTx.end()) { | if (it != mapTx.end()) { | ||||
ancestors = it->GetCountWithAncestors(); | ancestors = it->GetCountWithAncestors(); | ||||
descendants = CalculateDescendantMaximum(it); | descendants = CalculateDescendantMaximum(it); | ||||
} | } | ||||
} | } | ||||
bool CTxMemPool::IsLoaded() const { | |||||
LOCK(cs); | |||||
return m_is_loaded; | |||||
} | |||||
void CTxMemPool::SetIsLoaded(bool loaded) { | |||||
LOCK(cs); | |||||
m_is_loaded = loaded; | |||||
} | |||||
SaltedTxidHasher::SaltedTxidHasher() | SaltedTxidHasher::SaltedTxidHasher() | ||||
: k0(GetRand(std::numeric_limits<uint64_t>::max())), | : k0(GetRand(std::numeric_limits<uint64_t>::max())), | ||||
k1(GetRand(std::numeric_limits<uint64_t>::max())) {} | k1(GetRand(std::numeric_limits<uint64_t>::max())) {} | ||||
/** Maximum bytes for transactions to store for processing during reorg */ | /** Maximum bytes for transactions to store for processing during reorg */ | ||||
static const size_t MAX_DISCONNECTED_TX_POOL_SIZE = 20 * DEFAULT_MAX_BLOCK_SIZE; | static const size_t MAX_DISCONNECTED_TX_POOL_SIZE = 20 * DEFAULT_MAX_BLOCK_SIZE; | ||||
void DisconnectedBlockTransactions::addForBlock( | void DisconnectedBlockTransactions::addForBlock( | ||||
▲ Show 20 Lines • Show All 139 Lines • Show Last 20 Lines |