Add CWallet::ExtractAddress method
[novacoin.git] / src / qt / transactionrecord.cpp
index 34d3edf..e28a64b 100644 (file)
@@ -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,14 +43,14 @@ QList<TransactionRecord> 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))
+
+                std::string address;
+                if (pwalletMain->ExtractAddress(txout.scriptPubKey, address))
                 {
-                    // Received by Bitcoin Address
                     sub.type = TransactionRecord::RecvWithAddress;
-                    sub.address = CBitcoinAddress(address).ToString();
+                    sub.address = address;
                 }
                 else
                 {
@@ -56,6 +58,7 @@ QList<TransactionRecord> TransactionRecord::decomposeTransaction(const CWallet *
                     sub.type = TransactionRecord::RecvFromOther;
                     sub.address = mapValue["from"];
                 }
+
                 if (wtx.IsCoinBase())
                 {
                     // Generated (proof-of-work)