aboutsummaryrefslogtreecommitdiff
path: root/src/wallet/rpcwallet.cpp
diff options
context:
space:
mode:
authorMarcoFalke <falke.marco@gmail.com>2019-04-15 11:09:10 -0400
committerMarcoFalke <falke.marco@gmail.com>2019-04-15 11:09:18 -0400
commit2a854a17816675d258757061a2a7f6ed1de94fc1 (patch)
tree8980c0021db8c1c964d797728ceb2c1f0be99b87 /src/wallet/rpcwallet.cpp
parent2a191b48463adc64dfb6187fccb7742c795dee60 (diff)
parentb4338c151d4788c33f4b7c54daaf7f94b193a624 (diff)
downloadbitcoin-2a854a17816675d258757061a2a7f6ed1de94fc1.tar.xz
Merge #15750: [rpc] Remove the addresses field from the getaddressinfo return object
b4338c151d [rpc] Remove the addresses field from the getaddressinfo return object (John Newbery) Pull request description: The "addresses" field was confusing because it refered to public keys using their P2PKH address. It was included in the return object when needed for backward compatibility. Remove that compatibility now that the -deprecatedrpc=validateaddress option has been removed. New applications should use the 'embedded'->'address' field for P2SH or P2WSH wrapped addresses, and 'pubkeys' for inspecting multisig participants. ACKs for commit b4338c: jonatack: ACK https://github.com/bitcoin/bitcoin/pull/15750/commits/b4338c151d4788c33f4b7c54daaf7f94b193a624. Tests [gist](https://gist.github.com/jonatack/31915e290bb1be39b9769dc9357385ca). Tree-SHA512: 2c207510e565df600428838bfc6db5211fa06aaace365e31cbd74f1d2376b598675cb90df2fc1440858d49b22095aaa9d6b9ce3de0aff22417fe72cc6a6a321f
Diffstat (limited to 'src/wallet/rpcwallet.cpp')
-rw-r--r--src/wallet/rpcwallet.cpp13
1 files changed, 2 insertions, 11 deletions
diff --git a/src/wallet/rpcwallet.cpp b/src/wallet/rpcwallet.cpp
index c0c9345bd7..0d804dcc10 100644
--- a/src/wallet/rpcwallet.cpp
+++ b/src/wallet/rpcwallet.cpp
@@ -3415,7 +3415,7 @@ class DescribeWalletAddressVisitor : public boost::static_visitor<UniValue>
public:
CWallet * const pwallet;
- void ProcessSubScript(const CScript& subscript, UniValue& obj, bool include_addresses = false) const
+ void ProcessSubScript(const CScript& subscript, UniValue& obj) const
{
// Always present: script type and redeemscript
std::vector<std::vector<unsigned char>> solutions_data;
@@ -3424,7 +3424,6 @@ public:
obj.pushKV("hex", HexStr(subscript.begin(), subscript.end()));
CTxDestination embedded;
- UniValue a(UniValue::VARR);
if (ExtractDestination(subscript, embedded)) {
// Only when the script corresponds to an address.
UniValue subobj(UniValue::VOBJ);
@@ -3437,7 +3436,6 @@ public:
// Always report the pubkey at the top level, so that `getnewaddress()['pubkey']` always works.
if (subobj.exists("pubkey")) obj.pushKV("pubkey", subobj["pubkey"]);
obj.pushKV("embedded", std::move(subobj));
- if (include_addresses) a.push_back(EncodeDestination(embedded));
} else if (which_type == TX_MULTISIG) {
// Also report some information on multisig scripts (which do not have a corresponding address).
// TODO: abstract out the common functionality between this logic and ExtractDestinations.
@@ -3445,17 +3443,10 @@ public:
UniValue pubkeys(UniValue::VARR);
for (size_t i = 1; i < solutions_data.size() - 1; ++i) {
CPubKey key(solutions_data[i].begin(), solutions_data[i].end());
- if (include_addresses) a.push_back(EncodeDestination(key.GetID()));
pubkeys.push_back(HexStr(key.begin(), key.end()));
}
obj.pushKV("pubkeys", std::move(pubkeys));
}
-
- // The "addresses" field is confusing because it refers to public keys using their P2PKH address.
- // For that reason, only add the 'addresses' field when needed for backward compatibility. New applications
- // can use the 'embedded'->'address' field for P2SH or P2WSH wrapped addresses, and 'pubkeys' for
- // inspecting multisig participants.
- if (include_addresses) obj.pushKV("addresses", std::move(a));
}
explicit DescribeWalletAddressVisitor(CWallet* _pwallet) : pwallet(_pwallet) {}
@@ -3478,7 +3469,7 @@ public:
UniValue obj(UniValue::VOBJ);
CScript subscript;
if (pwallet && pwallet->GetCScript(scriptID, subscript)) {
- ProcessSubScript(subscript, obj, pwallet->chain().rpcEnableDeprecated("validateaddress"));
+ ProcessSubScript(subscript, obj);
}
return obj;
}