Skip to content
2 changes: 2 additions & 0 deletions src/miner.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,8 @@ std::unique_ptr<CBlockTemplate> BlockAssembler::CreateNewBlock(const CScript& sc
pblock->vtx.emplace_back(qcTx);
pblocktemplate->vTxFees.emplace_back(0);
pblocktemplate->vTxSigOps.emplace_back(0);
nBlockSize += qcTx->GetTotalSize();
++nBlockTx;
}
}
}
Expand Down
10 changes: 10 additions & 0 deletions src/qt/forms/masternodelist.ui
Original file line number Diff line number Diff line change
Expand Up @@ -356,6 +356,16 @@
</property>
</widget>
</item>
<item>
<widget class="QCheckBox" name="checkBoxMyMasternodesOnly">
<property name="toolTip">
<string>Show only masternodes this wallet has keys for.</string>
</property>
<property name="text">
<string>My masternodes only</string>
</property>
</widget>
</item>
<item>
<spacer name="horizontalSpacer_4">
<property name="orientation">
Expand Down
37 changes: 37 additions & 0 deletions src/qt/masternodelist.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,17 @@ void MasternodeList::showContextMenuDIP3(const QPoint& point)
if (item) contextMenuDIP3->exec(QCursor::pos());
}

static bool CheckWalletOwnsScript(const CScript& script)
{
CTxDestination dest;
if (ExtractDestination(script, dest)) {
if ((boost::get<CKeyID>(&dest) && pwalletMain->HaveKey(*boost::get<CKeyID>(&dest))) || (boost::get<CScriptID>(&dest) && pwalletMain->HaveCScript(*boost::get<CScriptID>(&dest)))) {
return true;
}
}
return false;
}

void MasternodeList::StartAlias(std::string strAlias)
{
std::string strStatusHtml;
Expand Down Expand Up @@ -442,7 +453,26 @@ void MasternodeList::updateDIP3List()
nextPayments.emplace(dmn->proTxHash, mnList.GetHeight() + (int)i + 1);
}

std::set<COutPoint> setOutpts;
if (pwalletMain && ui->checkBoxMyMasternodesOnly->isChecked()) {
LOCK(pwalletMain->cs_wallet);
std::vector<COutPoint> vOutpts;
pwalletMain->ListProTxCoins(vOutpts);
for (const auto& outpt : vOutpts) {
setOutpts.emplace(outpt);
}
}

mnList.ForEachMN(false, [&](const CDeterministicMNCPtr& dmn) {
if (pwalletMain && ui->checkBoxMyMasternodesOnly->isChecked()) {
LOCK(pwalletMain->cs_wallet);
bool fMyMasternode = setOutpts.count(dmn->collateralOutpoint) ||
pwalletMain->HaveKey(dmn->pdmnState->keyIDOwner) ||
pwalletMain->HaveKey(dmn->pdmnState->keyIDVoting) ||
CheckWalletOwnsScript(dmn->pdmnState->scriptPayout) ||
CheckWalletOwnsScript(dmn->pdmnState->scriptOperatorPayout);
if (!fMyMasternode) return;
}
// populate list
// Address, Protocol, Status, Active Seconds, Last Seen, Pub Key
QTableWidgetItem* addressItem = new QTableWidgetItem(QString::fromStdString(dmn->pdmnState->addr.ToString()));
Expand Down Expand Up @@ -701,6 +731,13 @@ void MasternodeList::ShowQRCode(std::string strAlias)
dialog->show();
}

void MasternodeList::on_checkBoxMyMasternodesOnly_stateChanged(int state)
{
// no cooldown
nTimeFilterUpdatedDIP3 = GetTime() - MASTERNODELIST_FILTER_COOLDOWN_SECONDS;
fFilterUpdatedDIP3 = true;
}

CDeterministicMNCPtr MasternodeList::GetSelectedDIP3MN()
{
std::string strProTxHash;
Expand Down
1 change: 1 addition & 0 deletions src/qt/masternodelist.h
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ private Q_SLOTS:
void on_startMissingButton_clicked();
void on_tableWidgetMyMasternodes_itemSelectionChanged();
void on_UpdateButton_clicked();
void on_checkBoxMyMasternodesOnly_stateChanged(int state);

void extraInfoDIP3_clicked();
void copyProTxHash_clicked();
Expand Down
Loading