Skip to content

Commit b5e4506

Browse files
committed
Correct UI display/categorization of MRC payments
1 parent 3b21b86 commit b5e4506

5 files changed

+35
-8
lines changed

src/qt/transactiondesc.cpp

+6
Original file line numberDiff line numberDiff line change
@@ -139,6 +139,12 @@ QString TransactionDesc::toHTML(CWallet *wallet, CWalletTx &wtx, unsigned int vo
139139
case MinedType::POR_SIDE_STAKE_SEND:
140140
strHTML += tr("PoS+RR Side Stake Sent");
141141
break;
142+
case MinedType::MRC_RCV:
143+
strHTML += tr("MRC Payment Received");
144+
break;
145+
case MinedType::MRC_SEND:
146+
strHTML += tr("MRC Payment Sent");
147+
break;
142148
case MinedType::SUPERBLOCK:
143149
strHTML += tr("Mined - Superblock");
144150
break;

src/qt/transactiontablemodel.cpp

+8
Original file line numberDiff line numberDiff line change
@@ -420,6 +420,10 @@ QString TransactionTableModel::formatTxType(const TransactionRecord *wtx) const
420420
return tr("PoS Side Stake Sent");
421421
case MinedType::POR_SIDE_STAKE_SEND:
422422
return tr("PoS+RR Side Stake Sent");
423+
case MinedType::MRC_RCV:
424+
return tr("MRC Payment Received");
425+
case MinedType::MRC_SEND:
426+
return tr("MRC Payment Sent");
423427
case MinedType::SUPERBLOCK:
424428
return tr("Mined - Superblock");
425429
default:
@@ -462,6 +466,10 @@ QVariant TransactionTableModel::txAddressDecoration(const TransactionRecord *wtx
462466
return QIcon(":/icons/tx_pos_ss_sent");
463467
case MinedType::POR_SIDE_STAKE_SEND:
464468
return QIcon(":/icons/tx_por_ss_sent");
469+
case MinedType::MRC_RCV:
470+
return QIcon(":/icons/tx_por_ss");
471+
case MinedType::MRC_SEND:
472+
return QIcon(":/icons/tx_por_ss_sent");
465473
case MinedType::SUPERBLOCK:
466474
return QIcon(":/icons/superblock");
467475
default:

src/wallet/generated_type.h

+3-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,9 @@ enum MinedType
1616
POR_SIDE_STAKE_RCV = 5,
1717
POS_SIDE_STAKE_SEND = 6,
1818
POR_SIDE_STAKE_SEND = 7,
19-
SUPERBLOCK = 8
19+
MRC_RCV = 8,
20+
MRC_SEND = 9,
21+
SUPERBLOCK = 10
2022
};
2123

2224
#endif // BITCOIN_WALLET_GENERATED_TYPE_H

src/wallet/rpcwallet.cpp

+2
Original file line numberDiff line numberDiff line change
@@ -1436,6 +1436,8 @@ UniValue listreceivedbyaccount(const UniValue& params, bool fHelp)
14361436
case MinedType::POR_SIDE_STAKE_RCV : entry.pushKV("Type", "POR SIDE STAKE RECEIVED"); break;
14371437
case MinedType::POS_SIDE_STAKE_SEND : entry.pushKV("Type", "POS SIDE STAKE SENT"); break;
14381438
case MinedType::POR_SIDE_STAKE_SEND : entry.pushKV("Type", "POR SIDE STAKE SENT"); break;
1439+
case MinedType::MRC_RCV : entry.pushKV("Type", "MRC PAYMENT RECEIVED"); break;
1440+
case MinedType::MRC_SEND : entry.pushKV("Type", "MRC PAYMENT SENT"); break;
14391441
default : entry.pushKV("Type", "UNKNOWN"); break;
14401442
}
14411443
}

src/wallet/wallet.cpp

+16-7
Original file line numberDiff line numberDiff line change
@@ -2963,6 +2963,10 @@ MinedType GetGeneratedType(const CWallet *wallet, const uint256& tx, unsigned in
29632963
bool fIsCoinStakeMine = (wallet->IsMine(wallettx.vout[1]) != ISMINE_NO) ? true : false;
29642964
bool fIsOutputMine = (wallet->IsMine(wallettx.vout[vout]) != ISMINE_NO) ? true : false;
29652965

2966+
// This will be at an index value one unit beyond the end of the vector is m_mrc_researchers.size()
2967+
// in the claim is zero.
2968+
unsigned int mrc_index_start = wallettx.vout.size() - blkindex->m_mrc_researchers.size();
2969+
29662970
// If output 1 is mine and the pubkey (address) for the output is the same as
29672971
// output 1, it is a split stake return from my stake.
29682972
if (fIsCoinStakeMine && wallettx.vout[vout].scriptPubKey == wallettx.vout[1].scriptPubKey)
@@ -2987,27 +2991,32 @@ MinedType GetGeneratedType(const CWallet *wallet, const uint256& tx, unsigned in
29872991
return MinedType::POR_SIDE_STAKE_RCV;
29882992
}
29892993
// ... or the output is not mine, then this must be a
2990-
// sidestake sent to someone else.
2994+
// sidestake sent to someone else or an MRC payment.
29912995
else
29922996
{
2993-
if (blkindex->ResearchSubsidy() == 0)
2997+
if (blkindex->ResearchSubsidy() == 0 && vout < mrc_index_start) {
29942998
return MinedType::POS_SIDE_STAKE_SEND;
2995-
else
2999+
} else if (vout >= mrc_index_start) {
3000+
return MinedType::MRC_SEND;
3001+
} else {
29963002
return MinedType::POR_SIDE_STAKE_SEND;
3003+
}
29973004
}
29983005
}
29993006
// otherwise, the coinstake return is not mine... (i.e. someone else...)
30003007
else
30013008
{
30023009
// ... but the output is mine, then this must be a
3003-
// received sidestake from the staker.
3010+
// received sidestake or mrc payment from the staker.
30043011
if (fIsOutputMine)
30053012
{
3006-
if (blkindex->ResearchSubsidy() == 0)
3013+
if (blkindex->ResearchSubsidy() == 0 && vout < mrc_index_start) {
30073014
return MinedType::POS_SIDE_STAKE_RCV;
3008-
3009-
else
3015+
} else if (vout >= mrc_index_start) {
3016+
return MinedType::MRC_RCV;
3017+
} else {
30103018
return MinedType::POR_SIDE_STAKE_RCV;
3019+
}
30113020
}
30123021

30133022
// the asymmetry is that the case when neither the first coinstake output

0 commit comments

Comments
 (0)