X-Git-Url: https://git.novaco.in/?a=blobdiff_plain;f=src%2Fqt%2Ftransactionrecord.cpp;h=20c263e1fdd2cb3a0afc178c43ceb3c8b301a27c;hb=b0368da0e15b5506548da3462e14b038ca21ae69;hp=4c3071984f14fb0997de81c0eacf19610e048630;hpb=84a4a7763f386934da90e2bd1e355b70023fa9ca;p=novacoin.git diff --git a/src/qt/transactionrecord.cpp b/src/qt/transactionrecord.cpp index 4c30719..20c263e 100644 --- a/src/qt/transactionrecord.cpp +++ b/src/qt/transactionrecord.cpp @@ -25,13 +25,13 @@ QList TransactionRecord::decomposeTransaction(const CWallet * { QList parts; int64 nTime = wtx.GetTxTime(); - int64 nCredit = wtx.GetCredit(true); + int64 nCredit = wtx.GetCredit(false,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 (nNet > 0 || wtx.IsCoinBase()) + if (nNet > 0 || wtx.IsCoinBase() || wtx.IsCoinStake()) { // // Credit @@ -58,9 +58,20 @@ 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); } @@ -158,7 +169,7 @@ void TransactionRecord::updateStatus(const CWalletTx &wtx) (wtx.IsCoinBase() ? 1 : 0), wtx.nTimeReceived, idx); - status.confirmed = wtx.IsConfirmed(); + status.confirmed = wtx.IsTrusted(); status.depth = wtx.GetDepthInMainChain(); status.cur_num_blocks = nBestHeight; @@ -194,7 +205,7 @@ void TransactionRecord::updateStatus(const CWalletTx &wtx) // For generated transactions, determine maturity if(type == TransactionRecord::Generated) { - int64 nCredit = wtx.GetCredit(true); + int64 nCredit = wtx.GetCredit(false,true); if (nCredit == 0) { status.maturity = TransactionStatus::Immature;