aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorfanquake <fanquake@gmail.com>2020-02-20 20:10:40 +0800
committerfanquake <fanquake@gmail.com>2020-02-20 20:28:46 +0800
commit56fc2dfcc3e61a05f6e54c2479897162c8ae4c75 (patch)
tree81cbfdd57500ebb0b70d86f64fb8096bd028314d /src
parenteddcbfb109e592fdf39ea2c38c4d7ba183de3e34 (diff)
parent7f1475c7119e8c72bce39a63386a6ca859066b80 (diff)
downloadbitcoin-56fc2dfcc3e61a05f6e54c2479897162c8ae4c75.tar.xz
Merge #18122: rpc: update validateaddress RPCExamples to bech32
7f1475c7119e8c72bce39a63386a6ca859066b80 rpc: update validateaddress RPCExamples to bech32 (Sebastian Falbesoner) Pull request description: Another small step to get rid of legacy addresses in the RPC help texts and by that encourage the use of bech32 addresses by default. The (invalid) address is the same as in the `getaddressinfo` RPC (see 2ee0cb3330ccf70f0540cb42370796e32eff1569, kudos to jonatack!), I don't think it adds any value to have a different example address per RPC. ACKs for top commit: fanquake: ACK 7f1475c7119e8c72bce39a63386a6ca859066b80 MarcoFalke: ACK 7f1475c7119e8c72bce39a63386a6ca859066b80 Tree-SHA512: 2350f61fa942a9053f9f5c860ea446965dc7209c71c81bdb98a859d03ca23b225ad72c9c506e4a55c8d8988823d9cfbe808c1a452a1eeadb70ab186b146dd4ca
Diffstat (limited to 'src')
-rw-r--r--src/rpc/misc.cpp4
-rw-r--r--src/rpc/util.cpp1
-rw-r--r--src/rpc/util.h6
-rw-r--r--src/wallet/rpcwallet.cpp6
4 files changed, 11 insertions, 6 deletions
diff --git a/src/rpc/misc.cpp b/src/rpc/misc.cpp
index 2b4ee62c71..c8711f44d4 100644
--- a/src/rpc/misc.cpp
+++ b/src/rpc/misc.cpp
@@ -44,8 +44,8 @@ static UniValue validateaddress(const JSONRPCRequest& request)
"}\n"
},
RPCExamples{
- HelpExampleCli("validateaddress", "\"1PSSGeFHDnKNxiEyFrD1wcEaHr9hrQDDWc\"")
- + HelpExampleRpc("validateaddress", "\"1PSSGeFHDnKNxiEyFrD1wcEaHr9hrQDDWc\"")
+ HelpExampleCli("validateaddress", EXAMPLE_ADDRESS) +
+ HelpExampleRpc("validateaddress", EXAMPLE_ADDRESS)
},
}.Check(request);
diff --git a/src/rpc/util.cpp b/src/rpc/util.cpp
index 78586c22f9..7cefb2db96 100644
--- a/src/rpc/util.cpp
+++ b/src/rpc/util.cpp
@@ -14,6 +14,7 @@
#include <tuple>
const std::string UNIX_EPOCH_TIME = "UNIX epoch time";
+const std::string EXAMPLE_ADDRESS = "\"bc1q09vm5lfy0j5reeulh4x5752q25uqqvz34hufdl\"";
void RPCTypeCheck(const UniValue& params,
const std::list<UniValueType>& typesExpected,
diff --git a/src/rpc/util.h b/src/rpc/util.h
index 065a992a88..f5edf69713 100644
--- a/src/rpc/util.h
+++ b/src/rpc/util.h
@@ -28,6 +28,12 @@
*/
extern const std::string UNIX_EPOCH_TIME;
+/**
+ * Example bech32 address used in multiple RPCExamples. The address is intentionally
+ * invalid to prevent accidental transactions by users.
+ */
+extern const std::string EXAMPLE_ADDRESS;
+
class FillableSigningProvider;
class CPubKey;
class CScript;
diff --git a/src/wallet/rpcwallet.cpp b/src/wallet/rpcwallet.cpp
index bc4ec77e31..e8905e781c 100644
--- a/src/wallet/rpcwallet.cpp
+++ b/src/wallet/rpcwallet.cpp
@@ -3724,8 +3724,6 @@ UniValue getaddressinfo(const JSONRPCRequest& request)
return NullUniValue;
}
- const std::string example_address = "\"bc1q09vm5lfy0j5reeulh4x5752q25uqqvz34hufdl\"";
-
RPCHelpMan{"getaddressinfo",
"\nReturn information about the given bitcoin address.\n"
"Some of the information will only be present if the address is in the active wallet.\n",
@@ -3778,8 +3776,8 @@ UniValue getaddressinfo(const JSONRPCRequest& request)
"}\n"
},
RPCExamples{
- HelpExampleCli("getaddressinfo", example_address) +
- HelpExampleRpc("getaddressinfo", example_address)
+ HelpExampleCli("getaddressinfo", EXAMPLE_ADDRESS) +
+ HelpExampleRpc("getaddressinfo", EXAMPLE_ADDRESS)
},
}.Check(request);