mirror of
https://github.com/bitcoin/bitcoin.git
synced 2025-11-13 07:28:59 +01:00
Change CWallet addressgrouping to use CTxDestination instead of strings.
This is cleanup for the listaddressgroupings code. Also add some real help text.
This commit is contained in:
@@ -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_);
|
||||
|
||||
Reference in New Issue
Block a user