File tree Expand file tree Collapse file tree 5 files changed +13
-7
lines changed Expand file tree Collapse file tree 5 files changed +13
-7
lines changed Original file line number Diff line number Diff line change @@ -1089,7 +1089,8 @@ A few guidelines for introducing and reviewing new RPC interfaces:
1089
1089
new RPC is replacing a deprecated RPC, to avoid both RPCs confusingly
1090
1090
showing up in the command list.
1091
1091
1092
- - Use *invalid* bech32 addresses for `RPCExamples` help documentation.
1092
+ - Use *invalid* bech32 addresses (e.g. the constant ` EXAMPLE_ADDRESS ` ) for
1093
+ ` RPCExamples ` help documentation.
1093
1094
1094
1095
- * Rationale* : Prevent accidental transactions by users and encourage the use
1095
1096
of bech32 addresses by default.
Original file line number Diff line number Diff line change @@ -42,8 +42,8 @@ static UniValue validateaddress(const JSONRPCRequest& request)
42
42
" }\n "
43
43
},
44
44
RPCExamples{
45
- HelpExampleCli (" validateaddress" , " \" 1PSSGeFHDnKNxiEyFrD1wcEaHr9hrQDDWc \" " )
46
- + HelpExampleRpc (" validateaddress" , " \" 1PSSGeFHDnKNxiEyFrD1wcEaHr9hrQDDWc \" " )
45
+ HelpExampleCli (" validateaddress" , EXAMPLE_ADDRESS) +
46
+ HelpExampleRpc (" validateaddress" , EXAMPLE_ADDRESS )
47
47
},
48
48
}.Check (request);
49
49
Original file line number Diff line number Diff line change 14
14
#include < tuple>
15
15
16
16
const std::string UNIX_EPOCH_TIME = " UNIX epoch time" ;
17
+ const std::string EXAMPLE_ADDRESS = " \" bc1q09vm5lfy0j5reeulh4x5752q25uqqvz34hufdl\" " ;
17
18
18
19
void RPCTypeCheck (const UniValue& params,
19
20
const std::list<UniValueType>& typesExpected,
Original file line number Diff line number Diff line change 28
28
*/
29
29
extern const std::string UNIX_EPOCH_TIME;
30
30
31
+ /* *
32
+ * Example bech32 address used in multiple RPCExamples. The address is intentionally
33
+ * invalid to prevent accidental transactions by users.
34
+ */
35
+ extern const std::string EXAMPLE_ADDRESS;
36
+
31
37
class FillableSigningProvider ;
32
38
class CPubKey ;
33
39
class CScript ;
Original file line number Diff line number Diff line change @@ -3737,8 +3737,6 @@ UniValue getaddressinfo(const JSONRPCRequest& request)
3737
3737
return NullUniValue;
3738
3738
}
3739
3739
3740
- const std::string example_address = " \" bc1q09vm5lfy0j5reeulh4x5752q25uqqvz34hufdl\" " ;
3741
-
3742
3740
RPCHelpMan{" getaddressinfo" ,
3743
3741
" \n Return information about the given bitcoin address.\n "
3744
3742
" Some of the information will only be present if the address is in the active wallet.\n " ,
@@ -3791,8 +3789,8 @@ UniValue getaddressinfo(const JSONRPCRequest& request)
3791
3789
" }\n "
3792
3790
},
3793
3791
RPCExamples{
3794
- HelpExampleCli (" getaddressinfo" , example_address ) +
3795
- HelpExampleRpc (" getaddressinfo" , example_address )
3792
+ HelpExampleCli (" getaddressinfo" , EXAMPLE_ADDRESS ) +
3793
+ HelpExampleRpc (" getaddressinfo" , EXAMPLE_ADDRESS )
3796
3794
},
3797
3795
}.Check (request);
3798
3796
You can’t perform that action at this time.
0 commit comments