Use login address if nspv_listunspent doesn't specify

This commit is contained in:
jl777
2019-07-03 22:33:11 -11:00
parent b4b339af72
commit 1b4f65c45e
2 changed files with 9 additions and 4 deletions

View File

@@ -977,6 +977,7 @@ UniValue NSPV_login(char *wifstr);
UniValue NSPV_addressutxos(char *coinaddr);
UniValue NSPV_spentinfo(uint256 txid,int32_t vout);
uint256 Parseuint256(const char *hexstr);
extern std::string NSPV_address;
UniValue nspv_getinfo(const UniValue& params, bool fHelp)
{
@@ -994,6 +995,8 @@ UniValue nspv_login(const UniValue& params, bool fHelp)
UniValue nspv_listunspent(const UniValue& params, bool fHelp)
{
if ( params.size() == 0 && NSPV_address.size() != 0 )
return(NSPV_addressutxos((char *)NSPV_address.c_str()));
if ( fHelp || params.size() != 1 )
throw runtime_error("nspv_listunspent address\n");
return(NSPV_addressutxos((char *)params[0].get_str().c_str()));