aboutsummaryrefslogtreecommitdiff
path: root/src/rpcmisc.cpp
diff options
context:
space:
mode:
authorPeter Todd <pete@petertodd.org>2014-09-23 05:18:47 -0400
committerPeter Todd <pete@petertodd.org>2014-09-23 05:24:27 -0400
commit426a74ed3c3c98b791a8445dd276e89fc5d6175e (patch)
tree0d942efbc6ff7e28443097d7ae6228a5e814c9bc /src/rpcmisc.cpp
parent2027450d4270afdde691f71231f5c81282c2e711 (diff)
Add scriptPubKey field to validateaddress RPC call
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 dd45eefd58..d1ab5093ff 100644
--- a/src/rpcmisc.cpp
+++ b/src/rpcmisc.cpp
@@ -161,6 +161,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"
@@ -182,6 +183,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));