Skip to content

Commit

Permalink
activate chainparams for changing Tip() properly - WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
knst committed Jul 25, 2023
1 parent b3eaae3 commit 330dcdd
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/evo/mnhftx.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,7 @@ void CMNHFManager::UpdateChainParams(const CBlockIndex* const pindex)

CMNHFManager::Signals CMNHFManager::GetFromCache(const CBlockIndex* const pindex)
{
if (pindex == nullptr) return {};
const uint256& blockHash = pindex->GetBlockHash();
Signals signals{};
{
Expand Down
1 change: 1 addition & 0 deletions src/test/util/setup_common.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -244,6 +244,7 @@ TestingSetup::TestingSetup(const std::string& chainName, const std::vector<const
if (!::ChainstateActive().LoadGenesisBlock()) {
throw std::runtime_error("LoadGenesisBlock failed.");
}
// m_node.mnhf_manager->UpdateChainParams(m_node.chainman->ActiveTip());

m_node.banman = std::make_unique<BanMan>(GetDataDir() / "banlist.dat", nullptr, DEFAULT_MISBEHAVING_BANTIME);
m_node.peerman = PeerManager::make(chainparams, *m_node.connman, *m_node.addrman, m_node.banman.get(),
Expand Down
4 changes: 4 additions & 0 deletions src/validation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@
#include <masternode/sync.h>

#include <evo/evodb.h>
#include <evo/mnhftx.h>
#include <evo/specialtx.h>
#include <evo/specialtxman.h>
#include <governance/governance.h>
Expand Down Expand Up @@ -2959,6 +2960,9 @@ bool CChainState::ConnectTip(BlockValidationState& state, CBlockIndex* pindexNew
if (!FlushStateToDisk(state, FlushStateMode::IF_NEEDED)) {
return false;
}

//int64_t nTime_;
m_mnhfManager.UpdateChainParams(pindexNew);
int64_t nTime5 = GetTimeMicros(); nTimeChainState += nTime5 - nTime4;
LogPrint(BCLog::BENCHMARK, " - Writing chainstate: %.2fms [%.2fs (%.2fms/blk)]\n", (nTime5 - nTime4) * MILLI, nTimeChainState * MICRO, nTimeChainState * MILLI / nBlocksTotal);
// Remove conflicting transactions from the mempool.;
Expand Down

0 comments on commit 330dcdd

Please sign in to comment.