Commit 2f1de615 authored by Tom Bradshaw's avatar Tom Bradshaw

Fix timestamp for Transaction Records. Add Masternode and Systemnode txrecord types.

parent 2cf48571
Pipeline #899 failed with stage
in 101 minutes
......@@ -101,7 +101,7 @@ int CMerkleTx::GetDepthInMainChain(const CBlockIndex* &pindexRet, bool enableIX)
int CMerkleTx::GetBlocksToMaturity() const
{
if (!IsCoinBase())
if (!IsCoinBase() && !IsCoinStake())
return 0;
return std::max(0, (COINBASE_MATURITY+1) - GetDepthInMainChain());
}
......
......@@ -42,13 +42,20 @@ QList<TransactionRecord> TransactionRecord::decomposeTransaction(const CWallet *
uint256 hash = wtx.GetHash();
std::map<std::string, std::string> mapValue = wtx.mapValue;
if (nNet > 0 || wtx.IsCoinBase())
if (nNet > 0 || wtx.IsCoinBase() || wtx.IsCoinStake())
{
//
// Credit
//
BOOST_FOREACH(const CTxOut& txout, wtx.vout)
{
bool isPoSActive = false;
if (mapBlockIndex.count(wtx.hashBlock))
isPoSActive = mapBlockIndex.at(wtx.hashBlock)->nHeight >= Params().PoSStartHeight();
if ((wtx.IsCoinBase() || wtx.IsCoinStake()) && isPoSActive)
nTime = mapBlockIndex.at(wtx.hashBlock)->GetBlockTime();
for (unsigned int i = 0; i < wtx.vout.size(); i++) {
const CTxOut& txout = wtx.vout[i];
isminetype mine = wallet->IsMine(txout);
if(mine)
{
......@@ -71,7 +78,17 @@ QList<TransactionRecord> TransactionRecord::decomposeTransaction(const CWallet *
}
if (wtx.IsCoinBase())
{
// Generated
if (isPoSActive) {
//After PoS activates, only MN/SN rewards (and budget too) will be in coinbase tx
if (i == MN_PMT_SLOT)
sub.type = TransactionRecord::MasterNodeReward;
else if (i == SN_PMT_SLOT)
sub.type = TransactionRecord::SystemNodeReward;
} else {
//PoS not active, just consider this 'generated'
sub.type = TransactionRecord::Generated;
}
} else if (wtx.IsCoinStake()) {
sub.type = TransactionRecord::Generated;
}
......
......@@ -75,6 +75,8 @@ public:
{
Other,
Generated,
MasterNodeReward,
SystemNodeReward,
SendToAddress,
SendToOther,
RecvWithAddress,
......
......@@ -360,6 +360,10 @@ QString TransactionTableModel::formatTxType(const TransactionRecord *wtx) const
return tr("Payment to yourself");
case TransactionRecord::Generated:
return tr("Mined");
case TransactionRecord::MasterNodeReward:
return tr("Masternode Reward");
case TransactionRecord::SystemNodeReward:
return tr("Systemnode Reward");
default:
return QString();
......@@ -374,6 +378,8 @@ QVariant TransactionTableModel::txAddressDecoration(const TransactionRecord *wtx
return QIcon(":/icons/tx_mined");
case TransactionRecord::RecvWithAddress:
case TransactionRecord::RecvFromOther:
case TransactionRecord::MasterNodeReward:
case TransactionRecord::SystemNodeReward:
return QIcon(":/icons/tx_input");
case TransactionRecord::SendToAddress:
case TransactionRecord::SendToOther:
......@@ -398,6 +404,8 @@ QString TransactionTableModel::formatTxToAddress(const TransactionRecord *wtx, b
case TransactionRecord::RecvWithAddress:
case TransactionRecord::SendToAddress:
case TransactionRecord::Generated:
case TransactionRecord::MasterNodeReward:
case TransactionRecord::SystemNodeReward:
return lookupAddress(wtx->address, tooltip) + watchAddress;
case TransactionRecord::SendToOther:
return QString::fromStdString(wtx->address) + watchAddress;
......@@ -415,6 +423,8 @@ QVariant TransactionTableModel::addressColor(const TransactionRecord *wtx) const
case TransactionRecord::RecvWithAddress:
case TransactionRecord::SendToAddress:
case TransactionRecord::Generated:
case TransactionRecord::MasterNodeReward:
case TransactionRecord::SystemNodeReward:
{
QString label = walletModel->getAddressTableModel()->labelForAddress(QString::fromStdString(wtx->address));
if(label.isEmpty())
......
......@@ -91,6 +91,8 @@ TransactionView::TransactionView(QWidget *parent) :
TransactionFilterProxy::TYPE(TransactionRecord::SendToOther));
typeWidget->addItem(tr("To yourself"), TransactionFilterProxy::TYPE(TransactionRecord::SendToSelf));
typeWidget->addItem(tr("Mined"), TransactionFilterProxy::TYPE(TransactionRecord::Generated));
typeWidget->addItem(tr("Masternode Reward"), TransactionFilterProxy::TYPE(TransactionRecord::MasterNodeReward));
typeWidget->addItem(tr("Systemnode Reward"), TransactionFilterProxy::TYPE(TransactionRecord::SystemNodeReward));
typeWidget->addItem(tr("Other"), TransactionFilterProxy::TYPE(TransactionRecord::Other));
typeWidget->setCurrentIndex(settings.value("transactionType").toInt());
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment