Skip to content

Commit

Permalink
GUI: Differentiate Budget payment transaction records from MNs block …
Browse files Browse the repository at this point in the history
…reward records.

Github-Pull: bitcoin#2671
Rebased-From: 8be73ac
  • Loading branch information
furszy committed Dec 11, 2021
1 parent 139596e commit 55619cc
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 2 deletions.
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

0 comments on commit 55619cc

Please sign in to comment.