diff --git a/src/qt/addresstablemodel.cpp b/src/qt/addresstablemodel.cpp --- a/src/qt/addresstablemodel.cpp +++ b/src/qt/addresstablemodel.cpp @@ -4,6 +4,7 @@ #include +#include #include #include #include @@ -80,7 +81,8 @@ QString::fromStdString(address.purpose), address.is_mine); cachedAddressTable.append(AddressTableEntry( addressType, QString::fromStdString(address.name), - QString::fromStdString(EncodeDestination(address.dest)))); + QString::fromStdString(EncodeCashAddr( + address.dest, parent->walletModel->getChainParams())))); } // qLowerBound() and qUpperBound() require our cachedAddressTable list // to be sorted in asc order. Even though the map is already sorted this @@ -351,7 +353,8 @@ } walletModel->wallet().learnRelatedScripts(newKey, g_address_type); strAddress = - EncodeDestination(GetDestinationForKey(newKey, g_address_type)); + EncodeCashAddr(GetDestinationForKey(newKey, g_address_type), + walletModel->getChainParams()); } else { return QString(); } diff --git a/src/qt/coincontroldialog.cpp b/src/qt/coincontroldialog.cpp --- a/src/qt/coincontroldialog.cpp +++ b/src/qt/coincontroldialog.cpp @@ -5,6 +5,7 @@ #include #include +#include #include #include #include @@ -690,8 +691,8 @@ CCoinControlWidgetItem *itemWalletAddress = new CCoinControlWidgetItem(); itemWalletAddress->setCheckState(COLUMN_CHECKBOX, Qt::Unchecked); - QString sWalletAddress = - QString::fromStdString(EncodeDestination(coins.first)); + QString sWalletAddress = QString::fromStdString( + EncodeCashAddr(coins.first, model->getChainParams())); QString sWalletLabel = model->getAddressTableModel()->labelForAddress(sWalletAddress); if (sWalletLabel.isEmpty()) { @@ -733,8 +734,8 @@ CTxDestination outputAddress; QString sAddress = ""; if (ExtractDestination(out.txout.scriptPubKey, outputAddress)) { - sAddress = - QString::fromStdString(EncodeDestination(outputAddress)); + sAddress = QString::fromStdString( + EncodeCashAddr(outputAddress, model->getChainParams())); // if listMode or change => show bitcoin address. In tree mode, // address is not shown again for direct wallet address outputs diff --git a/src/qt/paymentserver.cpp b/src/qt/paymentserver.cpp --- a/src/qt/paymentserver.cpp +++ b/src/qt/paymentserver.cpp @@ -4,6 +4,7 @@ #include +#include #include #include #include @@ -600,7 +601,8 @@ CTxDestination dest; if (ExtractDestination(sendingTo.first, dest)) { // Append destination address - addresses.append(QString::fromStdString(EncodeDestination(dest))); + addresses.append( + QString::fromStdString(EncodeCashAddr(dest, Params()))); } else if (!recipient.authenticatedMerchant.isEmpty()) { // Unauthenticated payment requests to custom bitcoin addresses are // not supported diff --git a/src/qt/test/wallettests.cpp b/src/qt/test/wallettests.cpp --- a/src/qt/test/wallettests.cpp +++ b/src/qt/test/wallettests.cpp @@ -1,5 +1,6 @@ #include +#include #include #include #include @@ -58,7 +59,7 @@ SendCoinsEntry *entry = qobject_cast(entries->itemAt(0)->widget()); entry->findChild("payTo")->setText( - QString::fromStdString(EncodeDestination(address))); + QString::fromStdString(EncodeCashAddr(address, Params()))); entry->findChild("payAmount")->setValue(amount); uint256 txid; boost::signals2::scoped_connection c = diff --git a/src/qt/transactiondesc.cpp b/src/qt/transactiondesc.cpp --- a/src/qt/transactiondesc.cpp +++ b/src/qt/transactiondesc.cpp @@ -4,6 +4,7 @@ #include +#include #include #include #include @@ -205,8 +206,8 @@ !name.empty()) { strHTML += GUIUtil::HtmlEscape(name) + " "; } - strHTML += - GUIUtil::HtmlEscape(EncodeDestination(address)); + strHTML += GUIUtil::HtmlEscape( + EncodeCashAddr(address, wallet.getChainParams())); if (toSelf == ISMINE_SPENDABLE) { strHTML += " (own address)"; } else if (toSelf & ISMINE_WATCH_ONLY) { @@ -371,8 +372,8 @@ if (wallet.getAddress(address, &name) && !name.empty()) { strHTML += GUIUtil::HtmlEscape(name) + " "; } - strHTML += - QString::fromStdString(EncodeDestination(address)); + strHTML += QString::fromStdString( + EncodeCashAddr(address, wallet.getChainParams())); } strHTML = strHTML + " " + tr("Amount") + "=" + BitcoinUnits::formatHtmlWithUnit(unit, vout.nValue); diff --git a/src/qt/transactionrecord.cpp b/src/qt/transactionrecord.cpp --- a/src/qt/transactionrecord.cpp +++ b/src/qt/transactionrecord.cpp @@ -4,7 +4,9 @@ #include +#include #include +#include // For Params() #include #include #include @@ -54,7 +56,8 @@ if (wtx.txout_address_is_mine[i]) { // Received by Bitcoin Address sub.type = TransactionRecord::RecvWithAddress; - sub.address = EncodeDestination(wtx.txout_address[i]); + sub.address = + EncodeCashAddr(wtx.txout_address[i], Params()); } else { // Received by IP connection (deprecated features), or a // multisignature or other non-simple transaction @@ -121,7 +124,8 @@ if (!boost::get(&wtx.txout_address[nOut])) { // Sent to Bitcoin Address sub.type = TransactionRecord::SendToAddress; - sub.address = EncodeDestination(wtx.txout_address[nOut]); + sub.address = + EncodeCashAddr(wtx.txout_address[nOut], Params()); } else { // Sent to IP, or other non-address transaction like OP_EVAL sub.type = TransactionRecord::SendToOther; diff --git a/src/qt/walletmodel.cpp b/src/qt/walletmodel.cpp --- a/src/qt/walletmodel.cpp +++ b/src/qt/walletmodel.cpp @@ -4,7 +4,7 @@ #include -#include +#include #include #include #include @@ -350,7 +350,8 @@ const std::string &label, bool isMine, const std::string &purpose, ChangeType status) { - QString strAddress = QString::fromStdString(EncodeDestination(address)); + QString strAddress = QString::fromStdString( + EncodeCashAddr(address, walletmodel->getChainParams())); QString strLabel = QString::fromStdString(label); QString strPurpose = QString::fromStdString(purpose); @@ -473,5 +474,5 @@ } const CChainParams &WalletModel::getChainParams() const { - return GetConfig().GetChainParams(); + return Params(); }