Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[GUI] Differentiate Budget payment output records from MNs block reward records. #2671

Merged
merged 2 commits into from
Dec 8, 2021
Merged
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: 3 additions & 0 deletions src/chainparams.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,7 @@ class CMainParams : public CChainParams
consensus.nFutureTimeDriftPoS = 180;
consensus.nMaxMoneyOut = 21000000 * COIN;
consensus.nMNCollateralAmt = 10000 * COIN;
consensus.nMNBlockReward = 3 * COIN;
consensus.nProposalEstablishmentTime = 60 * 60 * 24; // must be at least a day old to make it into a budget
consensus.nStakeMinAge = 60 * 60;
consensus.nStakeMinDepth = 600;
Expand Down Expand Up @@ -290,6 +291,7 @@ class CTestNetParams : public CChainParams
consensus.nFutureTimeDriftPoS = 180;
consensus.nMaxMoneyOut = 21000000 * COIN;
consensus.nMNCollateralAmt = 10000 * COIN;
consensus.nMNBlockReward = 3 * COIN;
consensus.nProposalEstablishmentTime = 60 * 5; // at least 5 min old to make it into a budget
consensus.nStakeMinAge = 60 * 60;
consensus.nStakeMinDepth = 100;
Expand Down Expand Up @@ -415,6 +417,7 @@ class CRegTestParams : public CChainParams
consensus.nFutureTimeDriftPoS = 180;
consensus.nMaxMoneyOut = 43199500 * COIN;
consensus.nMNCollateralAmt = 100 * COIN;
consensus.nMNBlockReward = 3 * COIN;
consensus.nProposalEstablishmentTime = 60 * 5; // at least 5 min old to make it into a budget
consensus.nStakeMinAge = 0;
consensus.nStakeMinDepth = 20;
Expand Down
1 change: 1 addition & 0 deletions src/consensus/params.h
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,7 @@ struct Params {
int nFutureTimeDriftPoS;
CAmount nMaxMoneyOut;
CAmount nMNCollateralAmt;
CAmount nMNBlockReward;
int64_t nProposalEstablishmentTime;
int nStakeMinAge;
int nStakeMinDepth;
Expand Down
1 change: 1 addition & 0 deletions src/qt/pivx/qtutils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -182,6 +182,7 @@ void setSortTxTypeFilter(QComboBox* filter, SortEdit* lineEditType)
filter->addItem(QObject::tr("Hot stakes"), TransactionFilterProxy::TYPE(TransactionRecord::StakeHot));
filter->addItem(QObject::tr("Delegated"), TransactionFilterProxy::TYPE(TransactionRecord::P2CSDelegationSent) | TransactionFilterProxy::TYPE(TransactionRecord::P2CSDelegationSentOwner));
filter->addItem(QObject::tr("Delegations"), TransactionFilterProxy::TYPE(TransactionRecord::P2CSDelegation));
filter->addItem(QObject::tr("DAO payment"), TransactionFilterProxy::TYPE(TransactionRecord::BudgetPayment));
}

void setupSettings(QSettings* settings)
Expand Down
1 change: 1 addition & 0 deletions src/qt/pivx/txrow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ void TxRow::setType(bool isLightTheme, int type, bool isConfirmed)
case TransactionRecord::StakeZPIV:
case TransactionRecord::MNReward:
case TransactionRecord::StakeMint:
case TransactionRecord::BudgetPayment:
path = "://ic-transaction-staked";
css = "text-list-amount-receive";
break;
Expand Down
2 changes: 1 addition & 1 deletion src/qt/transactionfilterproxy.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,6 @@ int TransactionFilterProxy::rowCount(const QModelIndex& parent) const
bool TransactionFilterProxy::isOrphan(const int status, const int type)
{
return ( (type == TransactionRecord::Generated || type == TransactionRecord::StakeMint ||
type == TransactionRecord::StakeZPIV || type == TransactionRecord::MNReward)
type == TransactionRecord::StakeZPIV || type == TransactionRecord::MNReward || type == TransactionRecord::BudgetPayment)
&& (status == TransactionStatus::Conflicted || status == TransactionStatus::NotAccepted) );
}
5 changes: 4 additions & 1 deletion src/qt/transactionrecord.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,11 @@ bool TransactionRecord::decomposeCoinStake(const CWallet* wallet, const CWalletT
int nIndexMN = (int) wtx.tx->vout.size() - 1;
if (ExtractDestination(wtx.tx->vout[nIndexMN].scriptPubKey, destMN) && (mine = IsMine(*wallet, destMN)) ) {
sub.involvesWatchAddress = mine & ISMINE_WATCH_ONLY;
sub.type = TransactionRecord::MNReward;
sub.address = EncodeDestination(destMN);
sub.credit = wtx.tx->vout[nIndexMN].nValue;
// Simple way to differentiate budget payments from MN rewards.
CAmount mn_reward = Params().GetConsensus().nMNBlockReward;
sub.type = sub.credit > mn_reward ? TransactionRecord::BudgetPayment : TransactionRecord::MNReward;
}
}

Expand Down Expand Up @@ -612,6 +614,7 @@ void TransactionRecord::updateStatus(const CWalletTx& wtx, int chainHeight)
type == TransactionRecord::StakeMint ||
type == TransactionRecord::StakeZPIV ||
type == TransactionRecord::MNReward ||
type == TransactionRecord::BudgetPayment ||
type == TransactionRecord::StakeDelegated ||
type == TransactionRecord::StakeHot) {

Expand Down
1 change: 1 addition & 0 deletions src/qt/transactionrecord.h
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ class TransactionRecord
SendToOther,
RecvWithAddress,
MNReward,
BudgetPayment,
RecvFromOther,
SendToSelf,
ZerocoinMint,
Expand Down
4 changes: 4 additions & 0 deletions src/qt/transactiontablemodel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -435,6 +435,8 @@ QString TransactionTableModel::formatTxType(const TransactionRecord* wtx) const
return tr("Received with");
case TransactionRecord::MNReward:
return tr("Masternode Reward");
case TransactionRecord::BudgetPayment:
return tr("Budget Payment");
case TransactionRecord::RecvFromOther:
return tr("Received from");
case TransactionRecord::SendToAddress:
Expand Down Expand Up @@ -493,6 +495,7 @@ QVariant TransactionTableModel::txAddressDecoration(const TransactionRecord* wtx
case TransactionRecord::StakeMint:
case TransactionRecord::StakeZPIV:
case TransactionRecord::MNReward:
case TransactionRecord::BudgetPayment:
return QIcon(":/icons/tx_mined");
case TransactionRecord::RecvWithAddress:
case TransactionRecord::RecvFromOther:
Expand Down Expand Up @@ -520,6 +523,7 @@ QString TransactionTableModel::formatTxToAddress(const TransactionRecord* wtx, b
return QString::fromStdString(wtx->address) + watchAddress;
case TransactionRecord::RecvWithAddress:
case TransactionRecord::MNReward:
case TransactionRecord::BudgetPayment:
case TransactionRecord::SendToAddress:
case TransactionRecord::Generated:
case TransactionRecord::StakeMint:
Expand Down
3 changes: 2 additions & 1 deletion src/validation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -834,7 +834,8 @@ CAmount GetBlockValue(int nHeight)

int64_t GetMasternodePayment()
{
return 3 * COIN;
// Future: refactor function callers to use this line directly.
return Params().GetConsensus().nMNBlockReward;
}

bool IsInitialBlockDownload()
Expand Down