@@ -198,7 +198,7 @@ UniValue getrawtransaction(const UniValue& params, bool fHelp)
198
198
#ifdef ENABLE_WALLET
199
199
UniValue listunspent (const UniValue& params, bool fHelp )
200
200
{
201
- if (fHelp || params.size () > 3 )
201
+ if (fHelp || params.size () > 4 )
202
202
throw runtime_error (
203
203
" listunspent ( minconf maxconf [\" address\" ,...] )\n "
204
204
" \n Returns array of unspent transaction outputs\n "
@@ -214,6 +214,7 @@ UniValue listunspent(const UniValue& params, bool fHelp)
214
214
" \" address\" (string) pivx address\n "
215
215
" ,...\n "
216
216
" ]\n "
217
+ " 4. watchonlyconfig (numberic, optional, default=1) 1 = list regular unspent transactions, 2 = list only watchonly transactions, 3 = list all unspent transactions (including watchonly)\n "
217
218
" \n Result\n "
218
219
" [ (array of json object)\n "
219
220
" {\n "
@@ -231,7 +232,7 @@ UniValue listunspent(const UniValue& params, bool fHelp)
231
232
" \n Examples\n " +
232
233
HelpExampleCli (" listunspent" , " " ) + HelpExampleCli (" listunspent" , " 6 9999999 \" [\\\" 1PGFqEzfmQch1gKD3ra4k18PNj3tTUUSqg\\\" ,\\\" 1LtvqCaApEdUGFkpKMM4MstjcaL4dKg8SP\\\" ]\" " ) + HelpExampleRpc (" listunspent" , " 6, 9999999 \" [\\\" 1PGFqEzfmQch1gKD3ra4k18PNj3tTUUSqg\\\" ,\\\" 1LtvqCaApEdUGFkpKMM4MstjcaL4dKg8SP\\\" ]\" " ));
233
234
234
- RPCTypeCheck (params, boost::assign::list_of (UniValue::VNUM)(UniValue::VNUM)(UniValue::VARR));
235
+ RPCTypeCheck (params, boost::assign::list_of (UniValue::VNUM)(UniValue::VNUM)(UniValue::VARR)(UniValue::VNUM) );
235
236
236
237
int nMinDepth = 1 ;
237
238
if (params.size () > 0 )
@@ -255,11 +256,18 @@ UniValue listunspent(const UniValue& params, bool fHelp)
255
256
}
256
257
}
257
258
259
+ int nWatchonlyConfig = 1 ;
260
+ if (params.size () > 3 ) {
261
+ nWatchonlyConfig = params[3 ].get_int ();
262
+ if (nWatchonlyConfig > 3 || nWatchonlyConfig < 1 )
263
+ nWatchonlyConfig = 1 ;
264
+ }
265
+
258
266
UniValue results (UniValue::VARR);
259
267
vector<COutput> vecOutputs;
260
268
assert (pwalletMain != NULL );
261
269
LOCK2 (cs_main, pwalletMain->cs_wallet );
262
- pwalletMain->AvailableCoins (vecOutputs, false );
270
+ pwalletMain->AvailableCoins (vecOutputs, false , NULL , false , ALL_COINS, false , nWatchonlyConfig );
263
271
BOOST_FOREACH (const COutput& out, vecOutputs) {
264
272
if (out.nDepth < nMinDepth || out.nDepth > nMaxDepth)
265
273
continue ;
0 commit comments