aboutsummaryrefslogtreecommitdiff
path: root/src/interfaces/wallet.cpp
diff options
context:
space:
mode:
authorWladimir J. van der Laan <laanwj@gmail.com>2018-04-25 19:15:30 +0200
committerWladimir J. van der Laan <laanwj@gmail.com>2018-04-25 19:32:32 +0200
commit25ad2f75f5d105d30d2ca716a66138a6b32a8c68 (patch)
tree0836355a6740398437a4ffab523ffa78886fdde0 /src/interfaces/wallet.cpp
parenta785bc3667d3c11a014da77436a23b1b865458a4 (diff)
parent5109fc4a9cb2cbd73c33197fb9129e1413ab051b (diff)
Merge #12830: [qt] [tests] Clarify address book error messages, add tests
5109fc4 [tests] [qt] Add tests for address book manipulation via EditAddressDialog (James O'Beirne) 9c01be1 [tests] [qt] Introduce qt/test/util with a generalized ConfirmMessage (James O'Beirne) 8cdcaee [qt] Display more helpful message when adding a send address has failed (James O'Beirne) c5b2770 Add purpose arg to Wallet::getAddress (James O'Beirne) Pull request description: Addresses https://github.com/bitcoin/bitcoin/issues/12796. When a user attempts to add to the address book a sending address which is already present as a receiving address, they're presented with a confusing error indicating the address is already present in the book, despite the fact that this row is currently invisible. ![selection_011](https://user-images.githubusercontent.com/73197/38096704-8a2948d2-3341-11e8-9632-7d563201f28c.jpg) This change adds a more specific error message indicating its existence as a receiving address (as discussed in the linked issue). ![selection_016](https://user-images.githubusercontent.com/73197/38198467-fa26164e-365a-11e8-8fc5-ddab9caf2fbd.jpg) This change also adds some tests exercising use of the address book via QT. Adding so much test code for such a trivial change may seem weird, but it's my hope that this will make further test-writing for address book usage (and other QT features) more approachable. Tree-SHA512: fbdd5564f7a9a2380bbe437f3378e8d4d5fd9201efff4879b72bc23f2cc1c2eecaf2b811994c25070ee052422e48e47901787c2e62cc584774a997fe6a2a327a
Diffstat (limited to 'src/interfaces/wallet.cpp')
-rw-r--r--src/interfaces/wallet.cpp8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/interfaces/wallet.cpp b/src/interfaces/wallet.cpp
index f4dfdae8ae..63b9d80a92 100644
--- a/src/interfaces/wallet.cpp
+++ b/src/interfaces/wallet.cpp
@@ -152,7 +152,10 @@ public:
{
return m_wallet.DelAddressBook(dest);
}
- bool getAddress(const CTxDestination& dest, std::string* name, isminetype* is_mine) override
+ bool getAddress(const CTxDestination& dest,
+ std::string* name,
+ isminetype* is_mine,
+ std::string* purpose) override
{
LOCK(m_wallet.cs_wallet);
auto it = m_wallet.mapAddressBook.find(dest);
@@ -165,6 +168,9 @@ public:
if (is_mine) {
*is_mine = IsMine(m_wallet, dest);
}
+ if (purpose) {
+ *purpose = it->second.purpose;
+ }
return true;
}
std::vector<WalletAddress> getAddresses() override