@ -43,7 +43,7 @@ CWallet *GetWalletForJSONRPCRequest(const JSONRPCRequest& request)
return pwallet ;
return pwallet ;
}
}
}
}
throw JSONRPCError ( RPC_ INVALID_PARAMETER , " Requested wallet does not exist or is not loaded " ) ;
throw JSONRPCError ( RPC_ WALLET_NOT_FOUND , " Requested wallet does not exist or is not loaded " ) ;
}
}
return : : vpwallets . size ( ) = = 1 | | ( request . fHelp & & : : vpwallets . size ( ) > 0 ) ? : : vpwallets [ 0 ] : nullptr ;
return : : vpwallets . size ( ) = = 1 | | ( request . fHelp & & : : vpwallets . size ( ) > 0 ) ? : : vpwallets [ 0 ] : nullptr ;
}
}
@ -57,13 +57,14 @@ std::string HelpRequiringPassphrase(CWallet * const pwallet)
bool EnsureWalletIsAvailable ( CWallet * const pwallet , bool avoidException )
bool EnsureWalletIsAvailable ( CWallet * const pwallet , bool avoidException )
{
{
if ( ! pwallet ) {
if ( pwallet ) return true ;
if ( ! avoidException )
if ( avoidException ) return false ;
if ( : : vpwallets . empty ( ) ) {
// Wallet RPC methods are disabled if no wallets are loaded.
throw JSONRPCError ( RPC_METHOD_NOT_FOUND , " Method not found (disabled) " ) ;
throw JSONRPCError ( RPC_METHOD_NOT_FOUND , " Method not found (disabled) " ) ;
else
return false ;
}
}
return true ;
throw JSONRPCError ( RPC_WALLET_NOT_SPECIFIED ,
" Wallet file not specified (must request wallet RPC through /wallet/<filename> uri-path). " ) ;
}
}
void EnsureWalletIsUnlocked ( CWallet * const pwallet )
void EnsureWalletIsUnlocked ( CWallet * const pwallet )