aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorglozow <gloriajzhao@gmail.com>2023-06-02 10:56:59 +0100
committerglozow <gloriajzhao@gmail.com>2023-06-02 10:59:35 +0100
commit6a560aceb75e618f3106a8850e053cd8de87616a (patch)
tree041a520f129fa866c15c2871ebdc1e742898ea62 /src
parent8a972813ba68307fa3a296e884b34928be96e246 (diff)
parent5d718f6913219d3ebe8394a17ddee81915e6f0ac (diff)
downloadbitcoin-6a560aceb75e618f3106a8850e053cd8de87616a.tar.xz
Merge bitcoin/bitcoin#27803: Fuzz: Mitigate timeout in CalculateTotalBumpFees
5d718f6913219d3ebe8394a17ddee81915e6f0ac Mitigate timeout in CalculateTotalBumpFees (Murch) Pull request description: The slow fuzz seed described in #27799 was just slower than expected, not an endless loop. Ensuring that every anscestor is only processed once speeds up the termination of the graph traversal. Fixes #27799 ACKs for top commit: glozow: ACK 5d718f6913219d3ebe8394a17ddee81915e6f0ac Tree-SHA512: f3c7cd2ef6716332136c75b43f6d54ce920be6f546a11bbf92b1fd65575607c42cc24b319691d86d0db038335636ba12b6387383a184f1589a8d71d1180f194f
Diffstat (limited to 'src')
-rw-r--r--src/node/mini_miner.cpp7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/node/mini_miner.cpp b/src/node/mini_miner.cpp
index 71ae9d23c7..6f253eddfa 100644
--- a/src/node/mini_miner.cpp
+++ b/src/node/mini_miner.cpp
@@ -346,15 +346,20 @@ std::optional<CAmount> MiniMiner::CalculateTotalBumpFees(const CFeeRate& target_
to_process.insert(iter);
ancestors.insert(iter);
}
+
+ std::set<uint256> has_been_processed;
while (!to_process.empty()) {
auto iter = to_process.begin();
const CTransaction& tx = (*iter)->second.GetTx();
for (const auto& input : tx.vin) {
if (auto parent_it{m_entries_by_txid.find(input.prevout.hash)}; parent_it != m_entries_by_txid.end()) {
- to_process.insert(parent_it);
+ if (!has_been_processed.count(input.prevout.hash)) {
+ to_process.insert(parent_it);
+ }
ancestors.insert(parent_it);
}
}
+ has_been_processed.insert(tx.GetHash());
to_process.erase(iter);
}
const auto ancestor_package_size = std::accumulate(ancestors.cbegin(), ancestors.cend(), int64_t{0},