X-Git-Url: https://git.novaco.in/?a=blobdiff_plain;f=src%2Fqt%2Ftransactionrecord.cpp;fp=src%2Fqt%2Ftransactionrecord.cpp;h=98b61718c200f4708eebd608a461503bb6d4d590;hb=d4488b9d263e4799f7bb4a1aaa1f692aa995f517;hp=e28a64bdc37826fc67a87e50353d10a3b9c5b1ad;hpb=fbd44e84d5841867d36d295d4f347fd5e55d293f;p=novacoin.git diff --git a/src/qt/transactionrecord.cpp b/src/qt/transactionrecord.cpp index e28a64b..98b6171 100644 --- a/src/qt/transactionrecord.cpp +++ b/src/qt/transactionrecord.cpp @@ -32,8 +32,11 @@ QList TransactionRecord::decomposeTransaction(const CWallet * int64_t nNet = nCredit - nDebit; uint256 hash = wtx.GetHash(), hashPrev = 0; std::map mapValue = wtx.mapValue; + + bool fCoinBase = wtx.IsCoinBase(), + fCoinStake = wtx.IsCoinStake(); - if (nNet > 0 || wtx.IsCoinBase() || wtx.IsCoinStake()) + if (nNet > 0 || fCoinBase || fCoinStake) { // // Credit @@ -46,11 +49,11 @@ QList TransactionRecord::decomposeTransaction(const CWallet * sub.idx = parts.size(); // sequence number sub.credit = txout.nValue; - std::string address; - if (pwalletMain->ExtractAddress(txout.scriptPubKey, address)) + CBitcoinAddress addressRet; + if (pwalletMain->ExtractAddress(txout.scriptPubKey, addressRet)) { sub.type = TransactionRecord::RecvWithAddress; - sub.address = address; + sub.address = addressRet.ToString(); } else { @@ -59,21 +62,18 @@ QList TransactionRecord::decomposeTransaction(const CWallet * sub.address = mapValue["from"]; } - if (wtx.IsCoinBase()) + if (fCoinBase || fCoinStake) { - // Generated (proof-of-work) + // Generated 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; + if (fCoinStake) + { + // proof-of-stake + if (hashPrev == hash) + continue; // last coinstake output + sub.credit = nNet > 0 ? nNet : wtx.GetValueOut() - nDebit; + hashPrev = hash; + } } parts.append(sub);