Skip to content

Commit

Permalink
Enable Standard Masternode Update Service
Browse files Browse the repository at this point in the history
  • Loading branch information
BLOCXTECH committed Feb 17, 2024
1 parent 24b12fa commit 636ff0b
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 40 deletions.
2 changes: 1 addition & 1 deletion configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ dnl require autoconf 2.60 (AS_ECHO/AS_ECHO_N)
AC_PREREQ([2.60])
define(_CLIENT_VERSION_MAJOR, 3)
define(_CLIENT_VERSION_MINOR, 1)
define(_CLIENT_VERSION_REVISION, 0)
define(_CLIENT_VERSION_REVISION, 1)
define(_CLIENT_VERSION_BUILD, 0)
define(_CLIENT_VERSION_IS_RELEASE, true)
define(_COPYRIGHT_YEAR, 2021)
Expand Down
6 changes: 0 additions & 6 deletions src/consensus/tx_verify.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -156,12 +156,6 @@ bool CheckTransaction(const CTransaction& tx, CValidationState &state)
allowEmptyTxInOut = true;
}

/* The Masternode update service has been temporarily disabled.
User can spend the MN collateral and create Masternode again to start receiving rewards.*/
if (tx.nType == TRANSACTION_PROVIDER_UPDATE_SERVICE) {
return false;
}

// Basic checks that don't depend on any context
if (!allowEmptyTxInOut && tx.vin.empty())
return state.DoS(10, false, REJECT_INVALID, "bad-txns-vin-empty");
Expand Down
51 changes: 18 additions & 33 deletions src/qt/masternodelist.cpp
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
#include <qt/masternodelist.h>
#include <qt/forms/ui_masternodelist.h>
#include <qt/masternodelist.h>

#include <qt/clientmodel.h>
#include <clientversion.h>
#include <coins.h>
#include <qt/guiutil.h>
#include <netbase.h>
#include <qt/clientmodel.h>
#include <qt/guiutil.h>
#include <qt/walletmodel.h>

#include <univalue.h>
Expand Down Expand Up @@ -54,8 +54,8 @@ MasternodeList::MasternodeList(QWidget* parent) :
ui->setupUi(this);

GUIUtil::setFont({ui->label_count_2,
ui->countLabelDIP3
}, GUIUtil::FontWeight::Bold, 14);
ui->countLabelDIP3},
GUIUtil::FontWeight::Bold, 14);
GUIUtil::setFont({ui->label_filter_2}, GUIUtil::FontWeight::Normal, 15);

int columnAddressWidth = 200;
Expand Down Expand Up @@ -202,18 +202,11 @@ void MasternodeList::updateDIP3List()

nTimeUpdatedDIP3 = GetTime();

auto projectedPayeesTierOne = mnList.GetProjectedMNPayeesTierOne(mnList.GetAllTierOneMNCount());
std::map<uint256, int> nextPaymentsOne;
for (size_t i = 0; i < projectedPayeesTierOne.size(); i++) {
const auto& dmn = projectedPayeesTierOne[i];
nextPaymentsOne.emplace(dmn->proTxHash, mnList.GetHeight() + (int)i + 1);
}

auto projectedPayeesTierTwo = mnList.GetProjectedMNPayeesTierTwo(mnList.GetAllTierTwoMNCount());
std::map<uint256, int> nextPaymentsTwo;
for (size_t i = 0; i < projectedPayeesTierTwo.size(); i++) {
const auto& dmn = projectedPayeesTierTwo[i];
nextPaymentsTwo.emplace(dmn->proTxHash, mnList.GetHeight() + (int)i + 1);
auto projectedPayees = mnList.GetProjectedMNPayees(mnList.GetValidMNsCount());
std::map<uint256, int> nextPayments;
for (size_t i = 0; i < projectedPayees.size(); i++) {
const auto& dmn = projectedPayees[i];
nextPayments.emplace(dmn->proTxHash, mnList.GetHeight() + (int)i + 1);
}

std::set<COutPoint> setOutpts;
Expand All @@ -228,10 +221,10 @@ void MasternodeList::updateDIP3List()
mnList.ForEachMN(false, [&](const CDeterministicMNCPtr& dmn) {
if (walletModel && ui->checkBoxMyMasternodesOnly->isChecked()) {
bool fMyMasternode = setOutpts.count(dmn->collateralOutpoint) ||
walletModel->wallet().isSpendable(dmn->pdmnState->keyIDOwner) ||
walletModel->wallet().isSpendable(dmn->pdmnState->keyIDVoting) ||
walletModel->wallet().isSpendable(dmn->pdmnState->scriptPayout) ||
walletModel->wallet().isSpendable(dmn->pdmnState->scriptOperatorPayout);
walletModel->wallet().isSpendable(dmn->pdmnState->keyIDOwner) ||
walletModel->wallet().isSpendable(dmn->pdmnState->keyIDVoting) ||
walletModel->wallet().isSpendable(dmn->pdmnState->scriptPayout) ||
walletModel->wallet().isSpendable(dmn->pdmnState->scriptOperatorPayout);
if (!fMyMasternode) return;
}
// populate list
Expand All @@ -247,17 +240,9 @@ void MasternodeList::updateDIP3List()

QString strNextPayment = "UNKNOWN";
int nNextPayment = 0;

if (dmn->nType == MnType::Standard_Masternode) {
if (nextPaymentsOne.count(dmn->proTxHash)) {
nNextPayment = nextPaymentsOne[dmn->proTxHash];
strNextPayment = QString::number(nNextPayment);
}
} else {
if (nextPaymentsTwo.count(dmn->proTxHash)) {
nNextPayment = nextPaymentsTwo[dmn->proTxHash];
strNextPayment = QString::number(nNextPayment);
}
if (nextPayments.count(dmn->proTxHash)) {
nNextPayment = nextPayments[dmn->proTxHash];
strNextPayment = QString::number(nNextPayment);
}
QTableWidgetItem* nextPaymentItem = new CMasternodeListWidgetItem<int>(strNextPayment, nNextPayment);

Expand Down Expand Up @@ -414,4 +399,4 @@ void MasternodeList::copyCollateralOutpoint_clicked()
}

QApplication::clipboard()->setText(QString::fromStdString(dmn->collateralOutpoint.ToStringShort()));
}
}
14 changes: 14 additions & 0 deletions src/validation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -638,6 +638,20 @@ static bool AcceptToMemoryPoolWorker(const CChainParams& chainparams, CTxMemPool
*pfMissingInputs = false;
}

if (chainActive.Tip()->nHeight > chainparams.GetConsensus().V3ForkHeight && tx.nType == TRANSACTION_PROVIDER_UPDATE_SERVICE) {
// this condition will be removed from next version
if (Params().NetworkIDString() == CBaseChainParams::MAIN && chainActive.Tip()->nHeight < 106300) {
return false;
}
CProUpServTx proTx;
if (GetTxPayload(tx, proTx)) {
auto dmn = deterministicMNManager->GetListAtChainTip().GetMN(proTx.proTxHash);
if (dmn->nType == MnType::Lite) {
return false;
}
}
}

if (!CheckTransaction(tx, state))
return false; // state filled in by CheckTransaction

Expand Down

0 comments on commit 636ff0b

Please sign in to comment.