@ -146,7 +146,7 @@ UniValue getnewaddress(const JSONRPCRequest& request)
// Parse the account first so we don't generate a key if there's an error
// Parse the account first so we don't generate a key if there's an error
std : : string strAccount ;
std : : string strAccount ;
if ( request . params . size ( ) > 0 )
if ( ! request . params [ 0 ] . isNull ( ) )
strAccount = AccountFromValue ( request . params [ 0 ] ) ;
strAccount = AccountFromValue ( request . params [ 0 ] ) ;
if ( ! pwallet - > IsLocked ( ) ) {
if ( ! pwallet - > IsLocked ( ) ) {
@ -217,7 +217,7 @@ UniValue getrawchangeaddress(const JSONRPCRequest& request)
return NullUniValue ;
return NullUniValue ;
}
}
if ( request . fHelp | | request . params . size ( ) > 1 )
if ( request . fHelp | | request . params . size ( ) > 0 )
throw std : : runtime_error (
throw std : : runtime_error (
" getrawchangeaddress \n "
" getrawchangeaddress \n "
" \n Returns a new Bitcoin address, for receiving change. \n "
" \n Returns a new Bitcoin address, for receiving change. \n "
@ -496,7 +496,7 @@ UniValue listaddressgroupings(const JSONRPCRequest& request)
return NullUniValue ;
return NullUniValue ;
}
}
if ( request . fHelp )
if ( request . fHelp | | request . params . size ( ) ! = 0 )
throw std : : runtime_error (
throw std : : runtime_error (
" listaddressgroupings \n "
" listaddressgroupings \n "
" \n Lists groups of addresses which have had their common ownership \n "
" \n Lists groups of addresses which have had their common ownership \n "
@ -641,7 +641,7 @@ UniValue getreceivedbyaddress(const JSONRPCRequest& request)
// Minimum confirmations
// Minimum confirmations
int nMinDepth = 1 ;
int nMinDepth = 1 ;
if ( request . params . size ( ) > 1 )
if ( ! request . params [ 1 ] . isNull ( ) )
nMinDepth = request . params [ 1 ] . get_int ( ) ;
nMinDepth = request . params [ 1 ] . get_int ( ) ;
// Tally
// Tally
@ -692,7 +692,7 @@ UniValue getreceivedbyaccount(const JSONRPCRequest& request)
// Minimum confirmations
// Minimum confirmations
int nMinDepth = 1 ;
int nMinDepth = 1 ;
if ( request . params . size ( ) > 1 )
if ( ! request . params [ 1 ] . isNull ( ) )
nMinDepth = request . params [ 1 ] . get_int ( ) ;
nMinDepth = request . params [ 1 ] . get_int ( ) ;
// Get the set of pub keys assigned to account
// Get the set of pub keys assigned to account
@ -769,10 +769,10 @@ UniValue getbalance(const JSONRPCRequest& request)
const std : : string * account = account_param ! = " * " ? & account_param : nullptr ;
const std : : string * account = account_param ! = " * " ? & account_param : nullptr ;
int nMinDepth = 1 ;
int nMinDepth = 1 ;
if ( request . params . size ( ) > 1 )
if ( ! request . params [ 1 ] . isNull ( ) )
nMinDepth = request . params [ 1 ] . get_int ( ) ;
nMinDepth = request . params [ 1 ] . get_int ( ) ;
isminefilter filter = ISMINE_SPENDABLE ;
isminefilter filter = ISMINE_SPENDABLE ;
if ( request . params . size ( ) > 2 )
if ( ! request . params [ 2 ] . isNull ( ) )
if ( request . params [ 2 ] . get_bool ( ) )
if ( request . params [ 2 ] . get_bool ( ) )
filter = filter | ISMINE_WATCH_ONLY ;
filter = filter | ISMINE_WATCH_ONLY ;
@ -975,7 +975,7 @@ UniValue sendmany(const JSONRPCRequest& request)
std : : string strAccount = AccountFromValue ( request . params [ 0 ] ) ;
std : : string strAccount = AccountFromValue ( request . params [ 0 ] ) ;
UniValue sendTo = request . params [ 1 ] . get_obj ( ) ;
UniValue sendTo = request . params [ 1 ] . get_obj ( ) ;
int nMinDepth = 1 ;
int nMinDepth = 1 ;
if ( request . params . size ( ) > 2 )
if ( ! request . params [ 2 ] . isNull ( ) )
nMinDepth = request . params [ 2 ] . get_int ( ) ;
nMinDepth = request . params [ 2 ] . get_int ( ) ;
CWalletTx wtx ;
CWalletTx wtx ;
@ -1222,16 +1222,16 @@ UniValue ListReceived(CWallet * const pwallet, const UniValue& params, bool fByA
{
{
// Minimum confirmations
// Minimum confirmations
int nMinDepth = 1 ;
int nMinDepth = 1 ;
if ( params . size ( ) > 0 )
if ( ! params [ 0 ] . isNull ( ) )
nMinDepth = params [ 0 ] . get_int ( ) ;
nMinDepth = params [ 0 ] . get_int ( ) ;
// Whether to include empty accounts
// Whether to include empty accounts
bool fIncludeEmpty = false ;
bool fIncludeEmpty = false ;
if ( params . size ( ) > 1 )
if ( ! params [ 1 ] . isNull ( ) )
fIncludeEmpty = params [ 1 ] . get_bool ( ) ;
fIncludeEmpty = params [ 1 ] . get_bool ( ) ;
isminefilter filter = ISMINE_SPENDABLE ;
isminefilter filter = ISMINE_SPENDABLE ;
if ( params . size ( ) > 2 )
if ( ! params [ 2 ] . isNull ( ) )
if ( params [ 2 ] . get_bool ( ) )
if ( params [ 2 ] . get_bool ( ) )
filter = filter | ISMINE_WATCH_ONLY ;
filter = filter | ISMINE_WATCH_ONLY ;
@ -1593,16 +1593,16 @@ UniValue listtransactions(const JSONRPCRequest& request)
LOCK2 ( cs_main , pwallet - > cs_wallet ) ;
LOCK2 ( cs_main , pwallet - > cs_wallet ) ;
std : : string strAccount = " * " ;
std : : string strAccount = " * " ;
if ( request . params . size ( ) > 0 )
if ( ! request . params [ 0 ] . isNull ( ) )
strAccount = request . params [ 0 ] . get_str ( ) ;
strAccount = request . params [ 0 ] . get_str ( ) ;
int nCount = 10 ;
int nCount = 10 ;
if ( request . params . size ( ) > 1 )
if ( ! request . params [ 1 ] . isNull ( ) )
nCount = request . params [ 1 ] . get_int ( ) ;
nCount = request . params [ 1 ] . get_int ( ) ;
int nFrom = 0 ;
int nFrom = 0 ;
if ( request . params . size ( ) > 2 )
if ( ! request . params [ 2 ] . isNull ( ) )
nFrom = request . params [ 2 ] . get_int ( ) ;
nFrom = request . params [ 2 ] . get_int ( ) ;
isminefilter filter = ISMINE_SPENDABLE ;
isminefilter filter = ISMINE_SPENDABLE ;
if ( request . params . size ( ) > 3 )
if ( ! request . params [ 3 ] . isNull ( ) )
if ( request . params [ 3 ] . get_bool ( ) )
if ( request . params [ 3 ] . get_bool ( ) )
filter = filter | ISMINE_WATCH_ONLY ;
filter = filter | ISMINE_WATCH_ONLY ;
@ -1742,7 +1742,7 @@ UniValue listsinceblock(const JSONRPCRequest& request)
return NullUniValue ;
return NullUniValue ;
}
}
if ( request . fHelp )
if ( request . fHelp | | request . params . size ( ) > 3 )
throw std : : runtime_error (
throw std : : runtime_error (
" listsinceblock ( \" blockhash \" target_confirmations include_watchonly) \n "
" listsinceblock ( \" blockhash \" target_confirmations include_watchonly) \n "
" \n Get all transactions in blocks since block [blockhash], or all transactions if omitted \n "
" \n Get all transactions in blocks since block [blockhash], or all transactions if omitted \n "
@ -1789,7 +1789,7 @@ UniValue listsinceblock(const JSONRPCRequest& request)
int target_confirms = 1 ;
int target_confirms = 1 ;
isminefilter filter = ISMINE_SPENDABLE ;
isminefilter filter = ISMINE_SPENDABLE ;
if ( request . params . size ( ) > 0 )
if ( ! request . params [ 0 ] . isNull ( ) )
{
{
uint256 blockId ;
uint256 blockId ;
@ -1808,7 +1808,7 @@ UniValue listsinceblock(const JSONRPCRequest& request)
}
}
}
}
if ( request . params . size ( ) > 1 )
if ( ! request . params [ 1 ] . isNull ( ) )
{
{
target_confirms = request . params [ 1 ] . get_int ( ) ;
target_confirms = request . params [ 1 ] . get_int ( ) ;
@ -1900,7 +1900,7 @@ UniValue gettransaction(const JSONRPCRequest& request)
hash . SetHex ( request . params [ 0 ] . get_str ( ) ) ;
hash . SetHex ( request . params [ 0 ] . get_str ( ) ) ;
isminefilter filter = ISMINE_SPENDABLE ;
isminefilter filter = ISMINE_SPENDABLE ;
if ( request . params . size ( ) > 1 )
if ( ! request . params [ 1 ] . isNull ( ) )
if ( request . params [ 1 ] . get_bool ( ) )
if ( request . params [ 1 ] . get_bool ( ) )
filter = filter | ISMINE_WATCH_ONLY ;
filter = filter | ISMINE_WATCH_ONLY ;
@ -2022,7 +2022,7 @@ UniValue keypoolrefill(const JSONRPCRequest& request)
// 0 is interpreted by TopUpKeyPool() as the default keypool size given by -keypool
// 0 is interpreted by TopUpKeyPool() as the default keypool size given by -keypool
unsigned int kpSize = 0 ;
unsigned int kpSize = 0 ;
if ( request . params . size ( ) > 0 ) {
if ( ! request . params [ 0 ] . isNull ( ) ) {
if ( request . params [ 0 ] . get_int ( ) < 0 )
if ( request . params [ 0 ] . get_int ( ) < 0 )
throw JSONRPCError ( RPC_INVALID_PARAMETER , " Invalid parameter, expected valid size. " ) ;
throw JSONRPCError ( RPC_INVALID_PARAMETER , " Invalid parameter, expected valid size. " ) ;
kpSize = ( unsigned int ) request . params [ 0 ] . get_int ( ) ;
kpSize = ( unsigned int ) request . params [ 0 ] . get_int ( ) ;
@ -2615,7 +2615,7 @@ UniValue listunspent(const JSONRPCRequest& request)
CAmount nMinimumSumAmount = MAX_MONEY ;
CAmount nMinimumSumAmount = MAX_MONEY ;
uint64_t nMaximumCount = 0 ;
uint64_t nMaximumCount = 0 ;
if ( request . params . size ( ) > 4 ) {
if ( ! request . params [ 4 ] . isNull ( ) ) {
const UniValue & options = request . params [ 4 ] . get_obj ( ) ;
const UniValue & options = request . params [ 4 ] . get_obj ( ) ;
if ( options . exists ( " minimumAmount " ) )
if ( options . exists ( " minimumAmount " ) )
@ -2684,7 +2684,7 @@ UniValue fundrawtransaction(const JSONRPCRequest& request)
return NullUniValue ;
return NullUniValue ;
}
}
if ( request . fHelp | | request . params . size ( ) < 1 | | request . params . size ( ) > 3 )
if ( request . fHelp | | request . params . size ( ) < 1 | | request . params . size ( ) > 2 )
throw std : : runtime_error (
throw std : : runtime_error (
" fundrawtransaction \" hexstring \" ( options ) \n "
" fundrawtransaction \" hexstring \" ( options ) \n "
" \n Add inputs to a transaction until it has enough in value to meet its out value. \n "
" \n Add inputs to a transaction until it has enough in value to meet its out value. \n "
@ -2746,7 +2746,7 @@ UniValue fundrawtransaction(const JSONRPCRequest& request)
UniValue subtractFeeFromOutputs ;
UniValue subtractFeeFromOutputs ;
std : : set < int > setSubtractFeeFromOutputs ;
std : : set < int > setSubtractFeeFromOutputs ;
if ( request . params . size ( ) > 1 ) {
if ( ! request . params [ 1 ] . isNull ( ) ) {
if ( request . params [ 1 ] . type ( ) = = UniValue : : VBOOL ) {
if ( request . params [ 1 ] . type ( ) = = UniValue : : VBOOL ) {
// backward compatibility bool only fallback
// backward compatibility bool only fallback
coinControl . fAllowWatchOnly = request . params [ 1 ] . get_bool ( ) ;
coinControl . fAllowWatchOnly = request . params [ 1 ] . get_bool ( ) ;
@ -2911,7 +2911,7 @@ UniValue bumpfee(const JSONRPCRequest& request)
CAmount totalFee = 0 ;
CAmount totalFee = 0 ;
CCoinControl coin_control ;
CCoinControl coin_control ;
coin_control . signalRbf = true ;
coin_control . signalRbf = true ;
if ( request . params . size ( ) > 1 ) {
if ( ! request . params [ 1 ] . isNull ( ) ) {
UniValue options = request . params [ 1 ] ;
UniValue options = request . params [ 1 ] ;
RPCTypeCheckObj ( options ,
RPCTypeCheckObj ( options ,
{
{