@@ -109,20 +109,14 @@ UniValue getinfo(const UniValue& params, bool fHelp)
109
109
#ifdef ENABLE_WALLET
110
110
class DescribeAddressVisitor : public boost ::static_visitor<UniValue>
111
111
{
112
- private:
113
- isminetype mine;
114
-
115
112
public:
116
- DescribeAddressVisitor (isminetype mineIn) : mine(mineIn) {}
117
-
118
113
UniValue operator ()(const CNoDestination &dest) const { return UniValue (UniValue::VOBJ); }
119
114
120
115
UniValue operator ()(const CKeyID &keyID) const {
121
116
UniValue obj (UniValue::VOBJ);
122
117
CPubKey vchPubKey;
123
118
obj.push_back (Pair (" isscript" , false ));
124
- if (mine == ISMINE_SPENDABLE) {
125
- pwalletMain->GetPubKey (keyID, vchPubKey);
119
+ if (pwalletMain->GetPubKey (keyID, vchPubKey)) {
126
120
obj.push_back (Pair (" pubkey" , HexStr (vchPubKey)));
127
121
obj.push_back (Pair (" iscompressed" , vchPubKey.IsCompressed ()));
128
122
}
@@ -131,10 +125,9 @@ class DescribeAddressVisitor : public boost::static_visitor<UniValue>
131
125
132
126
UniValue operator ()(const CScriptID &scriptID) const {
133
127
UniValue obj (UniValue::VOBJ);
128
+ CScript subscript;
134
129
obj.push_back (Pair (" isscript" , true ));
135
- if (mine != ISMINE_NO) {
136
- CScript subscript;
137
- pwalletMain->GetCScript (scriptID, subscript);
130
+ if (pwalletMain->GetCScript (scriptID, subscript)) {
138
131
std::vector<CTxDestination> addresses;
139
132
txnouttype whichType;
140
133
int nRequired;
@@ -200,11 +193,9 @@ UniValue validateaddress(const UniValue& params, bool fHelp)
200
193
#ifdef ENABLE_WALLET
201
194
isminetype mine = pwalletMain ? IsMine (*pwalletMain, dest) : ISMINE_NO;
202
195
ret.push_back (Pair (" ismine" , (mine & ISMINE_SPENDABLE) ? true : false ));
203
- if (mine != ISMINE_NO) {
204
- ret.push_back (Pair (" iswatchonly" , (mine & ISMINE_WATCH_ONLY) ? true : false ));
205
- UniValue detail = boost::apply_visitor (DescribeAddressVisitor (mine), dest);
206
- ret.pushKVs (detail);
207
- }
196
+ ret.push_back (Pair (" iswatchonly" , (mine & ISMINE_WATCH_ONLY) ? true : false ));
197
+ UniValue detail = boost::apply_visitor (DescribeAddressVisitor (), dest);
198
+ ret.pushKVs (detail);
208
199
if (pwalletMain && pwalletMain->mapAddressBook .count (dest))
209
200
ret.push_back (Pair (" account" , pwalletMain->mapAddressBook [dest].name ));
210
201
#endif
0 commit comments