aboutsummaryrefslogtreecommitdiff
path: root/src/wallet/rpcwallet.cpp
diff options
context:
space:
mode:
authorMarcoFalke <falke.marco@gmail.com>2020-04-07 18:47:28 +0800
committerMarcoFalke <falke.marco@gmail.com>2020-04-07 18:47:38 +0800
commit63dad673487d3623f9076721d2a1924263272eb9 (patch)
tree5840b35c0d1f2ca5755f34e1485057a7bb0ee570 /src/wallet/rpcwallet.cpp
parentd12568e2f8863e76d82de3c6bd933e9f5c20daaf (diff)
parent7a2ecf16df938dd95d3130a46082def7a02338eb (diff)
Merge #18546: Bugfix: Wallet: Safely deal with change in the address book [part 2]
7a2ecf16df938dd95d3130a46082def7a02338eb Wallet: Change IsMine check in CWallet::DelAddressBook from assert to failure (Luke Dashjr) 2952c46b923042f2de801f319e03ed5c4c4eb735 Wallet: Replace CAddressBookData.name with GetLabel() method (Luke Dashjr) d7092c392e10889cd7a080b3d22ed6446a59b87a QA: Test that change doesn't turn into non-change when spent in an avoid-reuse wallet (Luke Dashjr) Pull request description: Follow-up to #18192, not strictly necessary for 0.20 ACKs for top commit: MarcoFalke: re-ACK 7a2ecf16df, only change is adding an assert_equal in the test 🔰 jnewbery: utACK 7a2ecf16df938dd95d3130a46082def7a02338eb Tree-SHA512: e0933ee40f705b751697dc27249e1868ed4874254b174ebdd0a7150125d8c818402e66df2371718c7eeb90e67ee2317215fb260aa9b9d7b9b45ee436de2988ff
Diffstat (limited to 'src/wallet/rpcwallet.cpp')
-rw-r--r--src/wallet/rpcwallet.cpp20
1 files changed, 10 insertions, 10 deletions
diff --git a/src/wallet/rpcwallet.cpp b/src/wallet/rpcwallet.cpp
index 336a6cff72..769a343365 100644
--- a/src/wallet/rpcwallet.cpp
+++ b/src/wallet/rpcwallet.cpp
@@ -501,7 +501,7 @@ static UniValue listaddressgroupings(const JSONRPCRequest& request)
{
const auto* address_book_entry = pwallet->FindAddressBookEntry(address);
if (address_book_entry) {
- addressInfo.push_back(address_book_entry->name);
+ addressInfo.push_back(address_book_entry->GetLabel());
}
}
jsonGrouping.push_back(addressInfo);
@@ -1109,7 +1109,7 @@ static UniValue ListReceived(interfaces::Chain::Lock& locked_chain, const CWalle
{
if (item_it->second.IsChange()) continue;
const CTxDestination& address = item_it->first;
- const std::string& label = item_it->second.name;
+ const std::string& label = item_it->second.GetLabel();
auto it = mapTally.find(address);
if (it == mapTally.end() && !fIncludeEmpty)
continue;
@@ -1311,7 +1311,7 @@ static void ListTransactions(interfaces::Chain::Lock& locked_chain, const CWalle
entry.pushKV("amount", ValueFromAmount(-s.amount));
const auto* address_book_entry = pwallet->FindAddressBookEntry(s.destination);
if (address_book_entry) {
- entry.pushKV("label", address_book_entry->name);
+ entry.pushKV("label", address_book_entry->GetLabel());
}
entry.pushKV("vout", s.vout);
entry.pushKV("fee", ValueFromAmount(-nFee));
@@ -1329,7 +1329,7 @@ static void ListTransactions(interfaces::Chain::Lock& locked_chain, const CWalle
std::string label;
const auto* address_book_entry = pwallet->FindAddressBookEntry(r.destination);
if (address_book_entry) {
- label = address_book_entry->name;
+ label = address_book_entry->GetLabel();
}
if (filter_label && label != *filter_label) {
continue;
@@ -2963,7 +2963,7 @@ static UniValue listunspent(const JSONRPCRequest& request)
const auto* address_book_entry = pwallet->FindAddressBookEntry(address);
if (address_book_entry) {
- entry.pushKV("label", address_book_entry->name);
+ entry.pushKV("label", address_book_entry->GetLabel());
}
std::unique_ptr<SigningProvider> provider = pwallet->GetSolvingProvider(scriptPubKey);
@@ -3710,7 +3710,7 @@ static UniValue AddressBookDataToJSON(const CAddressBookData& data, const bool v
{
UniValue ret(UniValue::VOBJ);
if (verbose) {
- ret.pushKV("name", data.name);
+ ret.pushKV("name", data.GetLabel());
}
ret.pushKV("purpose", data.purpose);
return ret;
@@ -3822,7 +3822,7 @@ UniValue getaddressinfo(const JSONRPCRequest& request)
// value of the name key/value pair in the labels array below.
const auto* address_book_entry = pwallet->FindAddressBookEntry(dest);
if (pwallet->chain().rpcEnableDeprecated("label") && address_book_entry) {
- ret.pushKV("label", address_book_entry->name);
+ ret.pushKV("label", address_book_entry->GetLabel());
}
ret.pushKV("ischange", pwallet->IsChange(scriptPubKey));
@@ -3851,7 +3851,7 @@ UniValue getaddressinfo(const JSONRPCRequest& request)
if (pwallet->chain().rpcEnableDeprecated("labelspurpose")) {
labels.push_back(AddressBookDataToJSON(*address_book_entry, true));
} else {
- labels.push_back(address_book_entry->name);
+ labels.push_back(address_book_entry->GetLabel());
}
}
ret.pushKV("labels", std::move(labels));
@@ -3897,7 +3897,7 @@ static UniValue getaddressesbylabel(const JSONRPCRequest& request)
std::set<std::string> addresses;
for (const std::pair<const CTxDestination, CAddressBookData>& item : pwallet->m_address_book) {
if (item.second.IsChange()) continue;
- if (item.second.name == label) {
+ if (item.second.GetLabel() == label) {
std::string address = EncodeDestination(item.first);
// CWallet::m_address_book is not expected to contain duplicate
// address strings, but build a separate set as a precaution just in
@@ -3963,7 +3963,7 @@ static UniValue listlabels(const JSONRPCRequest& request)
for (const std::pair<const CTxDestination, CAddressBookData>& entry : pwallet->m_address_book) {
if (entry.second.IsChange()) continue;
if (purpose.empty() || entry.second.purpose == purpose) {
- label_set.insert(entry.second.name);
+ label_set.insert(entry.second.GetLabel());
}
}