X-Git-Url: https://git.novaco.in/?a=blobdiff_plain;f=src%2Fqt%2Ftransactionrecord.cpp;h=20c263e1fdd2cb3a0afc178c43ceb3c8b301a27c;hb=b0368da0e15b5506548da3462e14b038ca21ae69;hp=18858e20517f55953904fb4aa29c8eec94887365;hpb=6145f2d5e9f380a11bce933fe343d48fd8936a33;p=novacoin.git diff --git a/src/qt/transactionrecord.cpp b/src/qt/transactionrecord.cpp index 18858e2..20c263e 100644 --- a/src/qt/transactionrecord.cpp +++ b/src/qt/transactionrecord.cpp @@ -25,18 +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 (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); @@ -163,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; @@ -197,9 +203,9 @@ 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); + int64 nCredit = wtx.GetCredit(false,true); if (nCredit == 0) { status.maturity = TransactionStatus::Immature;