X-Git-Url: https://git.novaco.in/?a=blobdiff_plain;f=src%2Fqt%2Ftransactionrecord.cpp;h=ec4ba10be32883df539cb93b4a041c15b8d538ff;hb=98d23c1aaf2bfe1b1133c0f6adf9bceb586f31b2;hp=34d3edfc288bcb58f2a749f611693ca6e4e5bd38;hpb=f48c974108866253988f6cf88bad5b83b1a0f0b0;p=novacoin.git diff --git a/src/qt/transactionrecord.cpp b/src/qt/transactionrecord.cpp index 34d3edf..ec4ba10 100644 --- a/src/qt/transactionrecord.cpp +++ b/src/qt/transactionrecord.cpp @@ -3,6 +3,8 @@ #include "wallet.h" #include "base58.h" +extern CWallet* pwalletMain; + /* Return positive answer if transaction should be shown in list. */ bool TransactionRecord::showTransaction(const CWalletTx &wtx) @@ -41,20 +43,69 @@ QList TransactionRecord::decomposeTransaction(const CWallet * if(wallet->IsMine(txout)) { TransactionRecord sub(hash, nTime); - CTxDestination address; sub.idx = parts.size(); // sequence number sub.credit = txout.nValue; - if (ExtractDestination(txout.scriptPubKey, address) && IsMine(*wallet, address)) - { - // Received by Bitcoin Address - sub.type = TransactionRecord::RecvWithAddress; - sub.address = CBitcoinAddress(address).ToString(); - } - else + + if (!fTestNet) { - // Received by IP connection (deprecated features), or a multisignature or other non-simple transaction - sub.type = TransactionRecord::RecvFromOther; - sub.address = mapValue["from"]; + CTxDestination address; + if (ExtractDestination(txout.scriptPubKey, address) && IsMine(*wallet, address)) + { + // Received by Bitcoin Address + sub.type = TransactionRecord::RecvWithAddress; + sub.address = CBitcoinAddress(address).ToString(); + } + else + { + // Received by IP connection (deprecated features), or a multisignature or other non-simple transaction + sub.type = TransactionRecord::RecvFromOther; + sub.address = mapValue["from"]; + } + } + else + { + txnouttype whichType; + std::vector vSolutions; + if (Solver(txout.scriptPubKey, whichType, vSolutions)) + { + CTxDestination address; + if (whichType == TX_PUBKEY) + { + // Pay-to-Pubkey + address = CPubKey(vSolutions[0]).GetID(); + sub.type = TransactionRecord::RecvWithAddress; + sub.address = CBitcoinAddress(address).ToString(); + } + else if (whichType == TX_PUBKEYHASH) + { + // Pay-to-PubkeyHash + address = CKeyID(uint160(vSolutions[0])); + sub.type = TransactionRecord::RecvWithAddress; + sub.address = CBitcoinAddress(address).ToString(); + } + else if (whichType == TX_SCRIPTHASH) + { + // Pay-to-ScriptHash + address = CScriptID(uint160(vSolutions[0])); + sub.type = TransactionRecord::RecvWithAddress; + sub.address = CBitcoinAddress(address).ToString(); + } + else if (whichType == TX_PUBKEY_DROP) + { + // Pay-to-Pubkey-R + sub.type = TransactionRecord::RecvWithAddress; + + CMalleableKeyView view; + pwalletMain->CheckOwnership(CPubKey(vSolutions[0]), CPubKey(vSolutions[1]), view); + sub.address = view.GetMalleablePubKey().ToString(); + } + else + { + // Received by IP connection (deprecated features), or a multisignature or other non-simple transaction + sub.type = TransactionRecord::RecvFromOther; + sub.address = mapValue["from"]; + } + } } if (wtx.IsCoinBase()) {