mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-12-08 03:33:32 +01:00
Introduce wrappers around CBitcoinAddress
This patch removes the need for the intermediary Base58 type
CBitcoinAddress, by providing {Encode,Decode,IsValid}Destination
function that directly operate on the conversion between strings
and CTxDestination.
This commit is contained in:
@@ -91,9 +91,8 @@ QString TransactionDesc::toHTML(CWallet *wallet, CWalletTx &wtx, TransactionReco
|
||||
if (nNet > 0)
|
||||
{
|
||||
// Credit
|
||||
if (CBitcoinAddress(rec->address).IsValid())
|
||||
{
|
||||
CTxDestination address = CBitcoinAddress(rec->address).Get();
|
||||
if (IsValidDestinationString(rec->address)) {
|
||||
CTxDestination address = DecodeDestination(rec->address);
|
||||
if (wallet->mapAddressBook.count(address))
|
||||
{
|
||||
strHTML += "<b>" + tr("From") + ":</b> " + tr("unknown") + "<br>";
|
||||
@@ -118,7 +117,7 @@ QString TransactionDesc::toHTML(CWallet *wallet, CWalletTx &wtx, TransactionReco
|
||||
// Online transaction
|
||||
std::string strAddress = wtx.mapValue["to"];
|
||||
strHTML += "<b>" + tr("To") + ":</b> ";
|
||||
CTxDestination dest = CBitcoinAddress(strAddress).Get();
|
||||
CTxDestination dest = DecodeDestination(strAddress);
|
||||
if (wallet->mapAddressBook.count(dest) && !wallet->mapAddressBook[dest].name.empty())
|
||||
strHTML += GUIUtil::HtmlEscape(wallet->mapAddressBook[dest].name) + " ";
|
||||
strHTML += GUIUtil::HtmlEscape(strAddress) + "<br>";
|
||||
@@ -189,7 +188,7 @@ QString TransactionDesc::toHTML(CWallet *wallet, CWalletTx &wtx, TransactionReco
|
||||
strHTML += "<b>" + tr("To") + ":</b> ";
|
||||
if (wallet->mapAddressBook.count(address) && !wallet->mapAddressBook[address].name.empty())
|
||||
strHTML += GUIUtil::HtmlEscape(wallet->mapAddressBook[address].name) + " ";
|
||||
strHTML += GUIUtil::HtmlEscape(CBitcoinAddress(address).ToString());
|
||||
strHTML += GUIUtil::HtmlEscape(EncodeDestination(address));
|
||||
if(toSelf == ISMINE_SPENDABLE)
|
||||
strHTML += " (own address)";
|
||||
else if(toSelf & ISMINE_WATCH_ONLY)
|
||||
@@ -304,7 +303,7 @@ QString TransactionDesc::toHTML(CWallet *wallet, CWalletTx &wtx, TransactionReco
|
||||
{
|
||||
if (wallet->mapAddressBook.count(address) && !wallet->mapAddressBook[address].name.empty())
|
||||
strHTML += GUIUtil::HtmlEscape(wallet->mapAddressBook[address].name) + " ";
|
||||
strHTML += QString::fromStdString(CBitcoinAddress(address).ToString());
|
||||
strHTML += QString::fromStdString(EncodeDestination(address));
|
||||
}
|
||||
strHTML = strHTML + " " + tr("Amount") + "=" + BitcoinUnits::formatHtmlWithUnit(unit, vout.nValue);
|
||||
strHTML = strHTML + " IsMine=" + (wallet->IsMine(vout) & ISMINE_SPENDABLE ? tr("true") : tr("false")) + "</li>";
|
||||
|
||||
Reference in New Issue
Block a user