Skip to content

Commit

Permalink
fixups. Still not passing tests
Browse files Browse the repository at this point in the history
  • Loading branch information
theuni committed May 31, 2024
1 parent bc5d985 commit 9f237e6
Showing 1 changed file with 5 additions and 27 deletions.
32 changes: 5 additions & 27 deletions src/txmempool.h
Original file line number Diff line number Diff line change
Expand Up @@ -432,23 +432,7 @@ class MempoolContainer
return m_wtxid_map;
}
}
/*
template <int to, typename T>
const_iterator project(const T& from) const
{
static_assert(to == 0);
// if constexpr (std::is_same_v<T, descendent_order_iterator>) {
// return m_descendent_order.find(from);
// } else
if constexpr (std::is_same_v<T, wtxid_iterator_type>) {
//TODO check
return m_wtxid_map.find(from->first)->second;
} else if constexpr (std::is_same_v<T, time_order_iterator>) {
return m_time_order.find(from);
}
//return m_entries.end();
}
*/

size_t size() const
{
return m_entries.size();
Expand All @@ -464,8 +448,7 @@ class MempoolContainer
template <typename... Args>
std::pair<const_iterator, bool> emplace(Args&&... args)
{
m_entries.emplace_back(std::forward<Args>(args)...);
auto new_it = m_entries.end();
auto new_it = m_entries.emplace(m_entries.end(), std::forward<Args>(args)...);
m_txid_map.emplace(new_it->GetTx().GetHash(), new_it);
m_wtxid_map.emplace(new_it->GetTx().GetWitnessHash(), new_it);
m_descendent_order.insert(new_it);
Expand Down Expand Up @@ -497,8 +480,8 @@ class MempoolContainer

const_iterator iterator_to(const entry_type& entry) const
{
auto it = m_txid_map.find(entry.GetTx().GetHash());
if (it == m_txid_map.end()) return m_entries.end();
auto it = m_wtxid_map.find(entry.GetTx().GetWitnessHash());
if (it == m_wtxid_map.end()) return m_entries.end();
return it->second;
}

Expand All @@ -522,14 +505,9 @@ class MempoolContainer
const_iterator get_iter_from_wtxid(const uint256& wtxid) const
{
auto it = m_wtxid_map.find(wtxid);
if(it == m_wtxid_map.end()) return m_entries.end();
return it->second;
}
/*
const_iterator get_iter_from_entry_time(time_order_type::const_iterator it) const
{
return m_time_order.find(it);
}
*/
};

class CTxMemPool
Expand Down

0 comments on commit 9f237e6

Please sign in to comment.