mirror of
https://github.com/bitcoin/bitcoin.git
synced 2024-11-20 02:25:40 +01:00
Merge #18122: rpc: update validateaddress RPCExamples to bech32
7f1475c711
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 (see2ee0cb3330
, kudos to jonatack!), I don't think it adds any value to have a different example address per RPC. ACKs for top commit: fanquake: ACK7f1475c711
MarcoFalke: ACK7f1475c711
Tree-SHA512: 2350f61fa942a9053f9f5c860ea446965dc7209c71c81bdb98a859d03ca23b225ad72c9c506e4a55c8d8988823d9cfbe808c1a452a1eeadb70ab186b146dd4ca
This commit is contained in:
commit
56fc2dfcc3
@ -1089,7 +1089,8 @@ A few guidelines for introducing and reviewing new RPC interfaces:
|
||||
new RPC is replacing a deprecated RPC, to avoid both RPCs confusingly
|
||||
showing up in the command list.
|
||||
|
||||
- Use *invalid* bech32 addresses for `RPCExamples` help documentation.
|
||||
- Use *invalid* bech32 addresses (e.g. the constant `EXAMPLE_ADDRESS`) for
|
||||
`RPCExamples` help documentation.
|
||||
|
||||
- *Rationale*: Prevent accidental transactions by users and encourage the use
|
||||
of bech32 addresses by default.
|
||||
|
@ -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);
|
||||
|
||||
|
@ -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,
|
||||
|
@ -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;
|
||||
|
@ -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);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user