senderAddress
authorfsb4000 <fsb4000@yandex.ru>
Mon, 1 Dec 2014 14:43:50 +0000 (20:43 +0600)
committerfsb4000 <fsb4000@yandex.ru>
Mon, 1 Dec 2014 14:43:50 +0000 (20:43 +0600)
src/qt/transactiondesc.cpp

index f6d9c8c..543a40c 100644 (file)
@@ -84,7 +84,30 @@ QString TransactionDesc::toHTML(CWallet *wallet, CWalletTx &wtx)
                         {
                             if (wallet->mapAddressBook.count(address))
                             {
-                                strHTML += "<b>" + tr("From") + ":</b> " + tr("unknown") + "<br>";
+                                for (unsigned int i = 0; i < wtx.vin.size(); i++)
+                                {
+                                    uint256 hash;
+                                    const CTxIn& vin = wtx.vin[i];
+                                    hash.SetHex(vin.prevout.hash.ToString());
+                                    CTransaction wtxPrev;
+                                    uint256 hashBlock = 0;
+                                    if (!GetTransaction(hash, wtxPrev, hashBlock))
+                                    {
+                                        strHTML += "<b>" + tr("From") + ":</b> " + tr("unknown") + "<br>";
+                                        continue; 
+                                    }
+                                    CTxDestination senderAddress;
+                                    if (!ExtractDestination(wtxPrev.vout[vin.prevout.n].scriptPubKey, senderAddress) )
+                                    {
+                                        strHTML += "<b>" + tr("From") + ":</b> " + tr("unknown") + "<br>";
+                                    }
+                                    else
+                                    {
+                                        strHTML += "<b>" + tr("From") + ":</b> ";
+                                        strHTML += GUIUtil::HtmlEscape(CBitcoinAddress(senderAddress).ToString());
+                                        strHTML += "<br>";
+                                    }
+                                }
                                 strHTML += "<b>" + tr("To") + ":</b> ";
                                 strHTML += GUIUtil::HtmlEscape(CBitcoinAddress(address).ToString());
                                 if (!wallet->mapAddressBook[address].empty())