Skip to content

Commit

Permalink
Remove legacy MN list tabs on spork15 activation (#2567)
Browse files Browse the repository at this point in the history
* Remove legacy masternode tabs on DIP3 activation

* Move setInvisible call for dip3NoteLabel up

Otherwise it takes a minute until it's actually made invisible.

* Bail out early from updateMyNodeList when spork15 is active

Otherwise we risk accessing destroyed Qt objects.
  • Loading branch information
codablock authored Dec 19, 2018
1 parent 3c30a6a commit 1908637
Showing 1 changed file with 17 additions and 4 deletions.
21 changes: 17 additions & 4 deletions src/qt/masternodelist.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -277,6 +277,9 @@ void MasternodeList::updateMyNodeList(bool fForce)
if (ShutdownRequested()) {
return;
}
if (deterministicMNManager->IsDeterministicMNsSporkActive()) {
return;
}

TRY_LOCK(cs_mymnlist, fLockAcquired);
if (!fLockAcquired) return;
Expand Down Expand Up @@ -318,6 +321,16 @@ void MasternodeList::updateNodeList()
return;
}

if (deterministicMNManager->IsDeterministicMNsSporkActive()) {
// we misuse the fact that updateNodeList is called regularely here and remove both tabs
if (ui->tabWidget->indexOf(ui->tabDIP3Masternodes) != 0) {
// remove "My Masternode" and "All Masternodes" tabs
ui->tabWidget->removeTab(0);
ui->tabWidget->removeTab(0);
}
return;
}

TRY_LOCK(cs_mnlist, fLockAcquired);
if (!fLockAcquired) return;

Expand Down Expand Up @@ -392,6 +405,10 @@ void MasternodeList::updateDIP3List()
return;
}

if (deterministicMNManager->IsDeterministicMNsSporkActive()) {
ui->dip3NoteLabel->setVisible(false);
}

TRY_LOCK(cs_dip3list, fLockAcquired);
if (!fLockAcquired) return;

Expand All @@ -417,10 +434,6 @@ void MasternodeList::updateDIP3List()
ui->tableWidgetMasternodesDIP3->clearContents();
ui->tableWidgetMasternodesDIP3->setRowCount(0);

if (deterministicMNManager->IsDeterministicMNsSporkActive()) {
ui->dip3NoteLabel->setVisible(false);
}

auto mnList = deterministicMNManager->GetListAtChainTip();
auto projectedPayees = mnList.GetProjectedMNPayees(mnList.GetValidMNsCount());
std::map<uint256, int> nextPayments;
Expand Down

0 comments on commit 1908637

Please sign in to comment.