X-Git-Url: https://git.novaco.in/?p=novacoin.git;a=blobdiff_plain;f=src%2Fqt%2Ftransactionrecord.cpp;h=03862aec6509e8829564f042e4b39e54348a4665;hp=18858e20517f55953904fb4aa29c8eec94887365;hb=2c8f88fc67af7916670ce0086e6a9078df8182f0;hpb=a8c3b1b246d2662c9f3e3ff2f05c29883325c9f1 diff --git a/src/qt/transactionrecord.cpp b/src/qt/transactionrecord.cpp index 18858e2..03862ae 100644 --- a/src/qt/transactionrecord.cpp +++ b/src/qt/transactionrecord.cpp @@ -28,15 +28,10 @@ QList TransactionRecord::decomposeTransaction(const CWallet * int64 nCredit = wtx.GetCredit(true); int64 nDebit = wtx.GetDebit(); int64 nNet = nCredit - nDebit; - uint256 hash = wtx.GetHash(); + uint256 hash = wtx.GetHash(), hashPrev = 0; std::map mapValue = wtx.mapValue; - if (wtx.IsCoinStake()) - { - // Stake generation - parts.append(TransactionRecord(hash, nTime, TransactionRecord::StakeMint, "", -nDebit, wtx.GetValueOut())); - } - else if (nNet > 0 || wtx.IsCoinBase()) + if (nNet > 0 || wtx.IsCoinBase() || wtx.IsCoinStake()) { // // Credit @@ -63,8 +58,19 @@ QList TransactionRecord::decomposeTransaction(const CWallet * } if (wtx.IsCoinBase()) { - // Generated + // Generated (proof-of-work) + sub.type = TransactionRecord::Generated; + } + if (wtx.IsCoinStake()) + { + // Generated (proof-of-stake) + + if (hashPrev == hash) + continue; // last coinstake output + sub.type = TransactionRecord::Generated; + sub.credit = nNet > 0 ? nNet : wtx.GetValueOut() - nDebit; + hashPrev = hash; } parts.append(sub); @@ -197,7 +203,7 @@ void TransactionRecord::updateStatus(const CWalletTx &wtx) } // For generated transactions, determine maturity - if(type == TransactionRecord::Generated || type == TransactionRecord::StakeMint) + if(type == TransactionRecord::Generated) { int64 nCredit = wtx.GetCredit(true); if (nCredit == 0)