aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWladimir J. van der Laan <laanwj@gmail.com>2015-06-19 18:30:46 +0200
committerWladimir J. van der Laan <laanwj@gmail.com>2015-06-19 18:30:58 +0200
commit247b91449ad7d041c6af5d2abf5660ab00be0fb4 (patch)
tree150fb8fe2e048ac8ad7150012cdb14d82a10af9d
parent57539884f2097077c44f0abc13bc46629ab6249b (diff)
parent506bae3ac94ae9d5edfa794d9b80a7c9921ace17 (diff)
Merge pull request #6262
506bae3 Return all available information via validateaddress (dexX7)
-rw-r--r--src/rpcmisc.cpp21
1 files changed, 6 insertions, 15 deletions
diff --git a/src/rpcmisc.cpp b/src/rpcmisc.cpp
index fe6eb81b84..1d47bc06a5 100644
--- a/src/rpcmisc.cpp
+++ b/src/rpcmisc.cpp
@@ -109,20 +109,14 @@ UniValue getinfo(const UniValue& params, bool fHelp)
#ifdef ENABLE_WALLET
class DescribeAddressVisitor : public boost::static_visitor<UniValue>
{
-private:
- isminetype mine;
-
public:
- DescribeAddressVisitor(isminetype mineIn) : mine(mineIn) {}
-
UniValue operator()(const CNoDestination &dest) const { return UniValue(UniValue::VOBJ); }
UniValue operator()(const CKeyID &keyID) const {
UniValue obj(UniValue::VOBJ);
CPubKey vchPubKey;
obj.push_back(Pair("isscript", false));
- if (mine == ISMINE_SPENDABLE) {
- pwalletMain->GetPubKey(keyID, vchPubKey);
+ if (pwalletMain->GetPubKey(keyID, vchPubKey)) {
obj.push_back(Pair("pubkey", HexStr(vchPubKey)));
obj.push_back(Pair("iscompressed", vchPubKey.IsCompressed()));
}
@@ -131,10 +125,9 @@ public:
UniValue operator()(const CScriptID &scriptID) const {
UniValue obj(UniValue::VOBJ);
+ CScript subscript;
obj.push_back(Pair("isscript", true));
- if (mine != ISMINE_NO) {
- CScript subscript;
- pwalletMain->GetCScript(scriptID, subscript);
+ if (pwalletMain->GetCScript(scriptID, subscript)) {
std::vector<CTxDestination> addresses;
txnouttype whichType;
int nRequired;
@@ -200,11 +193,9 @@ UniValue validateaddress(const UniValue& params, bool fHelp)
#ifdef ENABLE_WALLET
isminetype mine = pwalletMain ? IsMine(*pwalletMain, dest) : ISMINE_NO;
ret.push_back(Pair("ismine", (mine & ISMINE_SPENDABLE) ? true : false));
- if (mine != ISMINE_NO) {
- ret.push_back(Pair("iswatchonly", (mine & ISMINE_WATCH_ONLY) ? true: false));
- UniValue detail = boost::apply_visitor(DescribeAddressVisitor(mine), dest);
- ret.pushKVs(detail);
- }
+ ret.push_back(Pair("iswatchonly", (mine & ISMINE_WATCH_ONLY) ? true: false));
+ UniValue detail = boost::apply_visitor(DescribeAddressVisitor(), dest);
+ ret.pushKVs(detail);
if (pwalletMain && pwalletMain->mapAddressBook.count(dest))
ret.push_back(Pair("account", pwalletMain->mapAddressBook[dest].name));
#endif