aboutsummaryrefslogtreecommitdiff
path: root/src/rpcmisc.cpp
diff options
context:
space:
mode:
authorJeff Garzik <jgarzik@bitpay.com>2014-12-31 07:05:14 -0500
committerJeff Garzik <jgarzik@bitpay.com>2014-12-31 07:05:14 -0500
commit95ecc0a857244dbf9e3969154c666c2f0bd7a232 (patch)
tree59d08f3a8fb459fb570fdaa6e796269766432408 /src/rpcmisc.cpp
parentaa5c0d34b7f4c10576914f1d07e1b823fd2f2c4b (diff)
parent426a74ed3c3c98b791a8445dd276e89fc5d6175e (diff)
Merge #4964 from
branch 'validateaddress-return-scriptpubkey' of git://github.com/petertodd/bitcoin into merge-4964
Diffstat (limited to 'src/rpcmisc.cpp')
-rw-r--r--src/rpcmisc.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/rpcmisc.cpp b/src/rpcmisc.cpp
index b8805b9d51..7c08a5c246 100644
--- a/src/rpcmisc.cpp
+++ b/src/rpcmisc.cpp
@@ -162,6 +162,7 @@ Value validateaddress(const Array& params, bool fHelp)
"{\n"
" \"isvalid\" : true|false, (boolean) If the address is valid or not. If not, this is the only property returned.\n"
" \"address\" : \"bitcoinaddress\", (string) The bitcoin address validated\n"
+ " \"scriptPubKey\" : \"hex\", (string) The hex encoded scriptPubKey generated by the address\n"
" \"ismine\" : true|false, (boolean) If the address is yours or not\n"
" \"isscript\" : true|false, (boolean) If the key is a script\n"
" \"pubkey\" : \"publickeyhex\", (string) The hex value of the raw public key\n"
@@ -183,6 +184,10 @@ Value validateaddress(const Array& params, bool fHelp)
CTxDestination dest = address.Get();
string currentAddress = address.ToString();
ret.push_back(Pair("address", currentAddress));
+
+ CScript scriptPubKey = GetScriptForDestination(dest);
+ ret.push_back(Pair("scriptPubKey", HexStr(scriptPubKey.begin(), scriptPubKey.end())));
+
#ifdef ENABLE_WALLET
isminetype mine = pwalletMain ? IsMine(*pwalletMain, dest) : ISMINE_NO;
ret.push_back(Pair("ismine", (mine & ISMINE_SPENDABLE) ? true : false));