mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-08-24 12:51:39 +02:00
interfaces, gui: Remove is_mine output parameter from getAddress
The is_mine output parameter is never used by any callers.
This commit is contained in:
@@ -117,7 +117,6 @@ public:
|
|||||||
//! Look up address in wallet, return whether exists.
|
//! Look up address in wallet, return whether exists.
|
||||||
virtual bool getAddress(const CTxDestination& dest,
|
virtual bool getAddress(const CTxDestination& dest,
|
||||||
std::string* name,
|
std::string* name,
|
||||||
wallet::isminetype* is_mine,
|
|
||||||
wallet::AddressPurpose* purpose) = 0;
|
wallet::AddressPurpose* purpose) = 0;
|
||||||
|
|
||||||
//! Get wallet address list.
|
//! Get wallet address list.
|
||||||
|
@@ -270,7 +270,7 @@ bool AddressTableModel::setData(const QModelIndex &index, const QVariant &value,
|
|||||||
// Check for duplicate addresses to prevent accidental deletion of addresses, if you try
|
// Check for duplicate addresses to prevent accidental deletion of addresses, if you try
|
||||||
// to paste an existing address over another address (with a different label)
|
// to paste an existing address over another address (with a different label)
|
||||||
if (walletModel->wallet().getAddress(
|
if (walletModel->wallet().getAddress(
|
||||||
newAddress, /* name= */ nullptr, /* is_mine= */ nullptr, /* purpose= */ nullptr))
|
newAddress, /*name=*/nullptr, /*purpose=*/ nullptr))
|
||||||
{
|
{
|
||||||
editStatus = DUPLICATE_ADDRESS;
|
editStatus = DUPLICATE_ADDRESS;
|
||||||
return false;
|
return false;
|
||||||
@@ -356,7 +356,7 @@ QString AddressTableModel::addRow(const QString &type, const QString &label, con
|
|||||||
// Check for duplicate addresses
|
// Check for duplicate addresses
|
||||||
{
|
{
|
||||||
if (walletModel->wallet().getAddress(
|
if (walletModel->wallet().getAddress(
|
||||||
DecodeDestination(strAddress), /* name= */ nullptr, /* is_mine= */ nullptr, /* purpose= */ nullptr))
|
DecodeDestination(strAddress), /*name=*/nullptr, /*purpose=*/nullptr))
|
||||||
{
|
{
|
||||||
editStatus = DUPLICATE_ADDRESS;
|
editStatus = DUPLICATE_ADDRESS;
|
||||||
return QString();
|
return QString();
|
||||||
@@ -429,7 +429,7 @@ bool AddressTableModel::getAddressData(const QString &address,
|
|||||||
std::string* name,
|
std::string* name,
|
||||||
wallet::AddressPurpose* purpose) const {
|
wallet::AddressPurpose* purpose) const {
|
||||||
CTxDestination destination = DecodeDestination(address.toStdString());
|
CTxDestination destination = DecodeDestination(address.toStdString());
|
||||||
return walletModel->wallet().getAddress(destination, name, /* is_mine= */ nullptr, purpose);
|
return walletModel->wallet().getAddress(destination, name, purpose);
|
||||||
}
|
}
|
||||||
|
|
||||||
int AddressTableModel::lookupAddress(const QString &address) const
|
int AddressTableModel::lookupAddress(const QString &address) const
|
||||||
|
@@ -143,8 +143,7 @@ QString TransactionDesc::toHTML(interfaces::Node& node, interfaces::Wallet& wall
|
|||||||
CTxDestination address = DecodeDestination(rec->address);
|
CTxDestination address = DecodeDestination(rec->address);
|
||||||
if (IsValidDestination(address)) {
|
if (IsValidDestination(address)) {
|
||||||
std::string name;
|
std::string name;
|
||||||
isminetype ismine;
|
if (wallet.getAddress(address, &name, /*purpose=*/nullptr))
|
||||||
if (wallet.getAddress(address, &name, &ismine, /* purpose= */ nullptr))
|
|
||||||
{
|
{
|
||||||
strHTML += "<b>" + tr("From") + ":</b> " + tr("unknown") + "<br>";
|
strHTML += "<b>" + tr("From") + ":</b> " + tr("unknown") + "<br>";
|
||||||
strHTML += "<b>" + tr("To") + ":</b> ";
|
strHTML += "<b>" + tr("To") + ":</b> ";
|
||||||
@@ -171,7 +170,7 @@ QString TransactionDesc::toHTML(interfaces::Node& node, interfaces::Wallet& wall
|
|||||||
CTxDestination dest = DecodeDestination(strAddress);
|
CTxDestination dest = DecodeDestination(strAddress);
|
||||||
std::string name;
|
std::string name;
|
||||||
if (wallet.getAddress(
|
if (wallet.getAddress(
|
||||||
dest, &name, /* is_mine= */ nullptr, /* purpose= */ nullptr) && !name.empty())
|
dest, &name, /*purpose=*/nullptr) && !name.empty())
|
||||||
strHTML += GUIUtil::HtmlEscape(name) + " ";
|
strHTML += GUIUtil::HtmlEscape(name) + " ";
|
||||||
strHTML += GUIUtil::HtmlEscape(strAddress) + "<br>";
|
strHTML += GUIUtil::HtmlEscape(strAddress) + "<br>";
|
||||||
}
|
}
|
||||||
@@ -236,7 +235,7 @@ QString TransactionDesc::toHTML(interfaces::Node& node, interfaces::Wallet& wall
|
|||||||
strHTML += "<b>" + tr("To") + ":</b> ";
|
strHTML += "<b>" + tr("To") + ":</b> ";
|
||||||
std::string name;
|
std::string name;
|
||||||
if (wallet.getAddress(
|
if (wallet.getAddress(
|
||||||
address, &name, /* is_mine= */ nullptr, /* purpose= */ nullptr) && !name.empty())
|
address, &name, /*purpose=*/nullptr) && !name.empty())
|
||||||
strHTML += GUIUtil::HtmlEscape(name) + " ";
|
strHTML += GUIUtil::HtmlEscape(name) + " ";
|
||||||
strHTML += GUIUtil::HtmlEscape(EncodeDestination(address));
|
strHTML += GUIUtil::HtmlEscape(EncodeDestination(address));
|
||||||
if(toSelf == ISMINE_SPENDABLE)
|
if(toSelf == ISMINE_SPENDABLE)
|
||||||
@@ -357,7 +356,7 @@ QString TransactionDesc::toHTML(interfaces::Node& node, interfaces::Wallet& wall
|
|||||||
if (ExtractDestination(vout.scriptPubKey, address))
|
if (ExtractDestination(vout.scriptPubKey, address))
|
||||||
{
|
{
|
||||||
std::string name;
|
std::string name;
|
||||||
if (wallet.getAddress(address, &name, /* is_mine= */ nullptr, /* purpose= */ nullptr) && !name.empty())
|
if (wallet.getAddress(address, &name, /*purpose=*/nullptr) && !name.empty())
|
||||||
strHTML += GUIUtil::HtmlEscape(name) + " ";
|
strHTML += GUIUtil::HtmlEscape(name) + " ";
|
||||||
strHTML += QString::fromStdString(EncodeDestination(address));
|
strHTML += QString::fromStdString(EncodeDestination(address));
|
||||||
}
|
}
|
||||||
|
@@ -268,7 +268,7 @@ void WalletModel::sendCoins(WalletModelTransaction& transaction)
|
|||||||
// Check if we have a new address or an updated label
|
// Check if we have a new address or an updated label
|
||||||
std::string name;
|
std::string name;
|
||||||
if (!m_wallet->getAddress(
|
if (!m_wallet->getAddress(
|
||||||
dest, &name, /* is_mine= */ nullptr, /* purpose= */ nullptr))
|
dest, &name, /*purpose=*/nullptr))
|
||||||
{
|
{
|
||||||
m_wallet->setAddressBook(dest, strLabel, wallet::AddressPurpose::SEND);
|
m_wallet->setAddressBook(dest, strLabel, wallet::AddressPurpose::SEND);
|
||||||
}
|
}
|
||||||
|
@@ -185,7 +185,6 @@ public:
|
|||||||
}
|
}
|
||||||
bool getAddress(const CTxDestination& dest,
|
bool getAddress(const CTxDestination& dest,
|
||||||
std::string* name,
|
std::string* name,
|
||||||
isminetype* is_mine,
|
|
||||||
AddressPurpose* purpose) override
|
AddressPurpose* purpose) override
|
||||||
{
|
{
|
||||||
LOCK(m_wallet->cs_wallet);
|
LOCK(m_wallet->cs_wallet);
|
||||||
@@ -194,16 +193,9 @@ public:
|
|||||||
if (name) {
|
if (name) {
|
||||||
*name = entry->GetLabel();
|
*name = entry->GetLabel();
|
||||||
}
|
}
|
||||||
std::optional<isminetype> dest_is_mine;
|
|
||||||
if (is_mine || purpose) {
|
|
||||||
dest_is_mine = m_wallet->IsMine(dest);
|
|
||||||
}
|
|
||||||
if (is_mine) {
|
|
||||||
*is_mine = *dest_is_mine;
|
|
||||||
}
|
|
||||||
if (purpose) {
|
if (purpose) {
|
||||||
// In very old wallets, address purpose may not be recorded so we derive it from IsMine
|
// In very old wallets, address purpose may not be recorded so we derive it from IsMine
|
||||||
*purpose = entry->purpose.value_or(*dest_is_mine ? AddressPurpose::RECEIVE : AddressPurpose::SEND);
|
*purpose = entry->purpose.value_or(m_wallet->IsMine(dest) ? AddressPurpose::RECEIVE : AddressPurpose::SEND);
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user