aboutsummaryrefslogtreecommitdiff
path: root/src/rpcrawtransaction.cpp
diff options
context:
space:
mode:
authorGregory Maxwell <greg@xiph.org>2012-08-20 13:43:33 -0400
committerGregory Maxwell <greg@xiph.org>2012-08-24 03:28:45 -0400
commitb1093efa833376a7883deb0cbcddd0aed364de84 (patch)
tree2c63671503ea5c8b3f53a6701d54d6a25cbae910 /src/rpcrawtransaction.cpp
parent92735bca313768dbc49789566c47e3a68ecef59a (diff)
Change CWallet addressgrouping to use CTxDestination instead of strings.
This is cleanup for the listaddressgroupings code. Also add some real help text.
Diffstat (limited to 'src/rpcrawtransaction.cpp')
-rw-r--r--src/rpcrawtransaction.cpp17
1 files changed, 12 insertions, 5 deletions
diff --git a/src/rpcrawtransaction.cpp b/src/rpcrawtransaction.cpp
index d6fb30cac6..2b6f4f7a4b 100644
--- a/src/rpcrawtransaction.cpp
+++ b/src/rpcrawtransaction.cpp
@@ -140,7 +140,7 @@ Value listunspent(const Array& params, bool fHelp)
{
if (fHelp || params.size() > 3)
throw runtime_error(
- "listunspent [minconf=1] [maxconf=9999999] ['addr1','addr2',...]\n"
+ "listunspent [minconf=1] [maxconf=9999999] [\"address\",...]\n"
"Returns array of unspent transaction outputs\n"
"with between minconf and maxconf (inclusive) confirmations.\n"
"Optionally filtered to only include txouts paid to specified addresses.\n"
@@ -165,7 +165,7 @@ Value listunspent(const Array& params, bool fHelp)
{
CBitcoinAddress address(input.get_str());
if (!address.IsValid())
- throw JSONRPCError(-5, string("Invalid Bitcoin address:")+input.get_str());
+ throw JSONRPCError(-5, string("Invalid Bitcoin address: ")+input.get_str());
if (setAddress.count(address))
throw JSONRPCError(-8, string("Invalid parameter, duplicated address: ")+input.get_str());
setAddress.insert(address);
@@ -180,8 +180,15 @@ Value listunspent(const Array& params, bool fHelp)
if (out.nDepth < nMinDepth || out.nDepth > nMaxDepth)
continue;
- if (setAddress.size() && !setAddress.count(out.tx->GetAddressOfTxOut(out.i)))
- continue;
+ if(setAddress.size())
+ {
+ CTxDestination address;
+ if(!ExtractDestination(out.tx->vout[out.i].scriptPubKey, address))
+ continue;
+
+ if (!setAddress.count(address))
+ continue;
+ }
int64 nValue = out.tx->vout[out.i].nValue;
const CScript& pk = out.tx->vout[out.i].scriptPubKey;
@@ -243,7 +250,7 @@ Value createrawtransaction(const Array& params, bool fHelp)
{
CBitcoinAddress address(s.name_);
if (!address.IsValid())
- throw JSONRPCError(-5, string("Invalid Bitcoin address:")+s.name_);
+ throw JSONRPCError(-5, string("Invalid Bitcoin address: ")+s.name_);
if (setAddress.count(address))
throw JSONRPCError(-8, string("Invalid parameter, duplicated address: ")+s.name_);