mirror of
https://github.com/ElementsProject/elements.git
synced 2026-08-14 12:43:40 +02:00
Extend validateaddress to check parent address validity.
This commit is contained in:
parent
85bcda52fc
commit
7e63ce39e8
1 changed files with 4 additions and 1 deletions
|
|
@ -49,6 +49,7 @@ static UniValue validateaddress(const JSONRPCRequest& request)
|
|||
"\nResult:\n"
|
||||
"{\n"
|
||||
" \"isvalid\" : true|false, (boolean) If the address is valid or not. If not, this is the only property returned.\n"
|
||||
" \"isvalid_parent\" : true|false (boolean) If the address is valid or not for parent chain. Valid or not, no additional details will be appended unlike `isvalid`.\n"
|
||||
" \"address\" : \"address\", (string) The bitcoin address validated\n"
|
||||
" \"scriptPubKey\" : \"hex\", (string) The hex encoded scriptPubKey generated by the address\n"
|
||||
" \"isscript\" : true|false, (boolean) If the key is a script\n"
|
||||
|
|
@ -62,10 +63,12 @@ static UniValue validateaddress(const JSONRPCRequest& request)
|
|||
);
|
||||
|
||||
CTxDestination dest = DecodeDestination(request.params[0].get_str());
|
||||
CTxDestination parent_dest = DecodeParentDestination(request.params[0].get_str());
|
||||
bool isValid = IsValidDestination(dest);
|
||||
|
||||
bool is_valid_parent = IsValidDestination(parent_dest);
|
||||
UniValue ret(UniValue::VOBJ);
|
||||
ret.pushKV("isvalid", isValid);
|
||||
ret.pushKV("isvalid_parent", is_valid_parent);
|
||||
if (isValid)
|
||||
{
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue