mirror of
https://github.com/bitcoin/bitcoin.git
synced 2026-01-20 07:09:15 +01:00
refactor: Convert mini_miner from uint256 to Txid
This commit is contained in:
@@ -16,6 +16,7 @@
|
||||
|
||||
#include <algorithm>
|
||||
#include <numeric>
|
||||
#include <ranges>
|
||||
#include <utility>
|
||||
|
||||
namespace node {
|
||||
@@ -61,12 +62,8 @@ MiniMiner::MiniMiner(const CTxMemPool& mempool, const std::vector<COutPoint>& ou
|
||||
if (m_requested_outpoints_by_txid.empty()) return;
|
||||
|
||||
// Calculate the cluster and construct the entry map.
|
||||
std::vector<uint256> txids_needed;
|
||||
txids_needed.reserve(m_requested_outpoints_by_txid.size());
|
||||
for (const auto& [txid, _]: m_requested_outpoints_by_txid) {
|
||||
txids_needed.push_back(txid);
|
||||
}
|
||||
const auto cluster = mempool.GatherClusters(txids_needed);
|
||||
auto txids_needed{m_requested_outpoints_by_txid | std::views::keys};
|
||||
const auto cluster = mempool.GatherClusters({txids_needed.begin(), txids_needed.end()});
|
||||
if (cluster.empty()) {
|
||||
// An empty cluster means that at least one of the transactions is missing from the mempool
|
||||
// (should not be possible given processing above) or DoS limit was hit.
|
||||
@@ -286,7 +283,7 @@ void MiniMiner::BuildMockTemplate(std::optional<CFeeRate> target_feerate)
|
||||
}
|
||||
// Track the order in which transactions were selected.
|
||||
for (const auto& ancestor : ancestors) {
|
||||
m_inclusion_order.emplace(Txid::FromUint256(ancestor->first), sequence_num);
|
||||
m_inclusion_order.emplace(ancestor->first, sequence_num);
|
||||
}
|
||||
DeleteAncestorPackage(ancestors);
|
||||
SanityCheck();
|
||||
@@ -409,7 +406,7 @@ std::optional<CAmount> MiniMiner::CalculateTotalBumpFees(const CFeeRate& target_
|
||||
ancestors.insert(iter);
|
||||
}
|
||||
|
||||
std::set<uint256> has_been_processed;
|
||||
std::set<Txid> has_been_processed;
|
||||
while (!to_process.empty()) {
|
||||
auto iter = to_process.begin();
|
||||
const CTransaction& tx = (*iter)->second.GetTx();
|
||||
|
||||
Reference in New Issue
Block a user