branch 'validateaddress-return-scriptpubkey' of git://github.com/petertodd/bitcoin into merge-4964
This commit is contained in:
Jeff Garzik 2014-12-31 07:05:14 -05:00
commit 95ecc0a857
Failed to extract signature

View File

@ -162,6 +162,7 @@ Value validateaddress(const Array& params, bool fHelp)
"{\n" "{\n"
" \"isvalid\" : true|false, (boolean) If the address is valid or not. If not, this is the only property returned.\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" " \"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" " \"ismine\" : true|false, (boolean) If the address is yours or not\n"
" \"isscript\" : true|false, (boolean) If the key is a script\n" " \"isscript\" : true|false, (boolean) If the key is a script\n"
" \"pubkey\" : \"publickeyhex\", (string) The hex value of the raw public key\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(); CTxDestination dest = address.Get();
string currentAddress = address.ToString(); string currentAddress = address.ToString();
ret.push_back(Pair("address", currentAddress)); ret.push_back(Pair("address", currentAddress));
CScript scriptPubKey = GetScriptForDestination(dest);
ret.push_back(Pair("scriptPubKey", HexStr(scriptPubKey.begin(), scriptPubKey.end())));
#ifdef ENABLE_WALLET #ifdef ENABLE_WALLET
isminetype mine = pwalletMain ? IsMine(*pwalletMain, dest) : ISMINE_NO; isminetype mine = pwalletMain ? IsMine(*pwalletMain, dest) : ISMINE_NO;
ret.push_back(Pair("ismine", (mine & ISMINE_SPENDABLE) ? true : false)); ret.push_back(Pair("ismine", (mine & ISMINE_SPENDABLE) ? true : false));