From bab3aa13ad369b5bc7dd13793924706d0c7071b6 Mon Sep 17 00:00:00 2001 From: UdjinM6 Date: Mon, 4 Dec 2023 13:37:59 +0300 Subject: [PATCH] fix: actually use `to_calculate` stack in `CMNHFManager::GetForBlock` (#5747) ## Issue being fixed or feature implemented Fixes a bug we missed in #5736 ## What was done? Use all collected indexes, not just the last one ## How Has This Been Tested? ## Breaking Changes n/a ## Checklist: - [x] I have performed a self-review of my own code - [ ] I have commented my code, particularly in hard-to-understand areas - [ ] I have added or updated relevant unit/integration/functional/e2e tests - [ ] I have made corresponding changes to the documentation - [x] I have assigned this pull request to a milestone _(for repository code-owners and collaborators only)_ --- src/evo/mnhftx.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/evo/mnhftx.cpp b/src/evo/mnhftx.cpp index 46c4868a85..853ff3efc2 100644 --- a/src/evo/mnhftx.cpp +++ b/src/evo/mnhftx.cpp @@ -278,12 +278,13 @@ CMNHFManager::Signals CMNHFManager::GetForBlock(const CBlockIndex* pindex) const Consensus::Params& consensusParams{Params().GetConsensus()}; while (!to_calculate.empty()) { + const CBlockIndex* pindex_top{to_calculate.top()}; CBlock block; - if (!ReadBlockFromDisk(block, pindex, consensusParams)) { + if (!ReadBlockFromDisk(block, pindex_top, consensusParams)) { throw std::runtime_error("failed-getehfforblock-read"); } BlockValidationState state; - signalsTmp = ProcessBlock(block, pindex, false, state); + signalsTmp = ProcessBlock(block, pindex_top, false, state); if (!signalsTmp.has_value()) { LogPrintf("%s: process block failed due to %s\n", __func__, state.ToString()); throw std::runtime_error("failed-getehfforblock-construct");