Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions src/evo/deterministicmns.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -606,9 +606,6 @@ bool CDeterministicMNManager::UndoBlock(
prevList = GetListForBlock(pindex->pprev);
}

evoDb.Erase(std::make_pair(DB_LIST_DIFF, blockHash));
evoDb.Erase(std::make_pair(DB_LIST_SNAPSHOT, blockHash));

mnListsCache.erase(blockHash);
}

Expand Down
22 changes: 22 additions & 0 deletions src/test/evo_deterministicmns_tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -601,6 +601,28 @@ BOOST_FIXTURE_TEST_CASE(dip3_invalidate_does_not_reuse_cached_descendant_mn_list
BOOST_CHECK_EQUAL(deterministicMNManager->GetListForBlock(chainActive.Tip()).GetAllMNsCount(), dmnHashes.size());
}

BOOST_FIXTURE_TEST_CASE(dip3_invalidate_preserves_orphan_mn_list, TestChainDIP3Setup)
{
auto utxos = BuildSimpleUtxoMap(coinbaseTxns);
auto payoutScript = GetCoinbaseKeyScript(coinbaseKey);
int port = 12500;

auto dmnHashes = RegisterDeterministicMNs(*this, utxos, 3, port, payoutScript);
auto orphanTip = chainActive.Tip();
const auto orphanHash = orphanTip->GetBlockHash();
const auto orphanHeight = orphanTip->nHeight;

InvalidateBlockAndUpdateMNManager(orphanHash);

const auto orphanList = deterministicMNManager->GetListForBlock(orphanTip);
BOOST_CHECK_EQUAL(orphanList.GetBlockHash().ToString(), orphanHash.ToString());
BOOST_CHECK_EQUAL(orphanList.GetHeight(), orphanHeight);
BOOST_REQUIRE_EQUAL(orphanList.GetAllMNsCount(), dmnHashes.size());
for (const auto& proTxHash : dmnHashes) {
BOOST_CHECK(orphanList.HasMN(proTxHash));
}
}

BOOST_FIXTURE_TEST_CASE(dip3_invalidate_pure_disconnect_notification_updates_tip_list, TestChainDIP3Setup)
{
auto utxos = BuildSimpleUtxoMap(coinbaseTxns);
Expand Down
Loading