|
52 | 52 | #include <masternode/payments.h>
|
53 | 53 | #include <masternode/sync.h>
|
54 | 54 |
|
| 55 | +#include <evo/deterministicmns.h> |
55 | 56 | #include <evo/evodb.h>
|
56 | 57 | #include <evo/mnhftx.h>
|
57 | 58 | #include <evo/specialtx.h>
|
@@ -1731,7 +1732,8 @@ DisconnectResult CChainState::DisconnectBlock(const CBlock& block, const CBlockI
|
1731 | 1732 | std::vector<std::pair<CAddressUnspentKey, CAddressUnspentValue> > addressUnspentIndex;
|
1732 | 1733 | std::vector<std::pair<CSpentIndexKey, CSpentIndexValue> > spentIndex;
|
1733 | 1734 |
|
1734 |
| - if (!UndoSpecialTxsInBlock(block, pindex, m_mnhfManager, *m_quorum_block_processor)) { |
| 1735 | + std::optional<MNListUpdates> mnlist_updates_opt{std::nullopt}; |
| 1736 | + if (!UndoSpecialTxsInBlock(block, pindex, m_mnhfManager, *m_quorum_block_processor, mnlist_updates_opt)) { |
1735 | 1737 | error("DisconnectBlock(): UndoSpecialTxsInBlock failed");
|
1736 | 1738 | return DISCONNECT_FAILED;
|
1737 | 1739 | }
|
@@ -1847,6 +1849,12 @@ DisconnectResult CChainState::DisconnectBlock(const CBlock& block, const CBlockI
|
1847 | 1849 | view.SetBestBlock(pindex->pprev->GetBlockHash());
|
1848 | 1850 | m_evoDb.WriteBestBlock(pindex->pprev->GetBlockHash());
|
1849 | 1851 |
|
| 1852 | + if (mnlist_updates_opt.has_value()) { |
| 1853 | + auto mnlu = mnlist_updates_opt.value(); |
| 1854 | + GetMainSignals().NotifyMasternodeListChanged(true, mnlu.old_list, mnlu.diff); |
| 1855 | + uiInterface.NotifyMasternodeListChanged(mnlu.new_list, pindex->pprev); |
| 1856 | + } |
| 1857 | + |
1850 | 1858 | auto finish = Now<SteadyMilliseconds>();
|
1851 | 1859 | auto diff = finish - start;
|
1852 | 1860 | statsClient.timing("DisconnectBlock_ms", count_milliseconds(diff), 1.0f);
|
@@ -2210,7 +2218,8 @@ bool CChainState::ConnectBlock(const CBlock& block, BlockValidationState& state,
|
2210 | 2218 | bool fDIP0001Active_context = pindex->nHeight >= Params().GetConsensus().DIP0001Height;
|
2211 | 2219 |
|
2212 | 2220 | // MUST process special txes before updating UTXO to ensure consistency between mempool and block processing
|
2213 |
| - if (!ProcessSpecialTxsInBlock(block, pindex, m_mnhfManager, *m_quorum_block_processor, *m_clhandler, m_params.GetConsensus(), view, fJustCheck, fScriptChecks, state)) { |
| 2221 | + std::optional<MNListUpdates> mnlist_updates_opt{std::nullopt}; |
| 2222 | + if (!ProcessSpecialTxsInBlock(block, pindex, m_mnhfManager, *m_quorum_block_processor, *m_clhandler, m_params.GetConsensus(), view, fJustCheck, fScriptChecks, state, mnlist_updates_opt)) { |
2214 | 2223 | return error("ConnectBlock(DASH): ProcessSpecialTxsInBlock for block %s failed with %s",
|
2215 | 2224 | pindex->GetBlockHash().ToString(), state.ToString());
|
2216 | 2225 | }
|
@@ -2470,6 +2479,12 @@ bool CChainState::ConnectBlock(const CBlock& block, BlockValidationState& state,
|
2470 | 2479 | view.SetBestBlock(pindex->GetBlockHash());
|
2471 | 2480 | m_evoDb.WriteBestBlock(pindex->GetBlockHash());
|
2472 | 2481 |
|
| 2482 | + if (mnlist_updates_opt.has_value()) { |
| 2483 | + auto mnlu = mnlist_updates_opt.value(); |
| 2484 | + GetMainSignals().NotifyMasternodeListChanged(false, mnlu.old_list, mnlu.diff); |
| 2485 | + uiInterface.NotifyMasternodeListChanged(mnlu.new_list, pindex); |
| 2486 | + } |
| 2487 | + |
2473 | 2488 | int64_t nTime8 = GetTimeMicros(); nTimeCallbacks += nTime8 - nTime5;
|
2474 | 2489 | LogPrint(BCLog::BENCHMARK, " - Callbacks: %.2fms [%.2fs (%.2fms/blk)]\n", MILLI * (nTime8 - nTime5), nTimeCallbacks * MICRO, nTimeCallbacks * MILLI / nBlocksTotal);
|
2475 | 2490 |
|
@@ -4838,7 +4853,8 @@ bool CChainState::RollforwardBlock(const CBlockIndex* pindex, CCoinsViewCache& i
|
4838 | 4853 |
|
4839 | 4854 | // MUST process special txes before updating UTXO to ensure consistency between mempool and block processing
|
4840 | 4855 | BlockValidationState state;
|
4841 |
| - if (!ProcessSpecialTxsInBlock(block, pindex, m_mnhfManager, *m_quorum_block_processor, *m_clhandler, m_params.GetConsensus(), inputs, false /*fJustCheck*/, false /*fScriptChecks*/, state)) { |
| 4856 | + std::optional<MNListUpdates> mnlist_updates_opt{std::nullopt}; |
| 4857 | + if (!ProcessSpecialTxsInBlock(block, pindex, m_mnhfManager, *m_quorum_block_processor, *m_clhandler, m_params.GetConsensus(), inputs, false /*fJustCheck*/, false /*fScriptChecks*/, state, mnlist_updates_opt)) { |
4842 | 4858 | return error("RollforwardBlock(DASH): ProcessSpecialTxsInBlock for block %s failed with %s",
|
4843 | 4859 | pindex->GetBlockHash().ToString(), state.ToString());
|
4844 | 4860 | }
|
|
0 commit comments