From 0cd2a732f0072369074b305d42f27cd5c2707e84 Mon Sep 17 00:00:00 2001 From: Arthur Britto Date: Sun, 10 Jun 2012 14:51:48 -0700 Subject: [PATCH] Improve RPC handling. --- src/NewcoinAddress.cpp | 3 ++- src/RPCServer.cpp | 8 ++++++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/src/NewcoinAddress.cpp b/src/NewcoinAddress.cpp index a621b7f75..f3b92ff3b 100644 --- a/src/NewcoinAddress.cpp +++ b/src/NewcoinAddress.cpp @@ -659,7 +659,8 @@ bool NewcoinAddress::setFamilySeedGeneric(const std::string& strText) NewcoinAddress naTemp; bool bResult = true; - if (naTemp.setAccountID(strText) + if (strText.empty() + || naTemp.setAccountID(strText) || naTemp.setAccountPublic(strText) || naTemp.setAccountPrivate(strText)) { diff --git a/src/RPCServer.cpp b/src/RPCServer.cpp index 758a2d0ba..0f11fbdea 100644 --- a/src/RPCServer.cpp +++ b/src/RPCServer.cpp @@ -847,6 +847,10 @@ Json::Value RPCServer::doDataFetch(Json::Value& params) // data_store Json::Value RPCServer::doDataStore(Json::Value& params) { + params = Json::Value(Json::arrayValue); + params.append(12); + params.append(34); + std::string strKey = params[0u].asString(); std::string strValue = params[1u].asString(); @@ -1571,7 +1575,7 @@ Json::Value RPCServer::doWalletAccounts(Json::Value& params) if (!naSeed.setFamilySeedGeneric(params[0u].asString())) { - return "seed expected"; + return RPCError(rpcBAD_SEED); } NewcoinAddress naMasterGenerator; @@ -1616,7 +1620,7 @@ Json::Value RPCServer::doWalletAdd(Json::Value& params) if (!naRegularSeed.setFamilySeedGeneric(params[0u].asString())) { - return "regular seed expected"; + return RPCError(rpcBAD_SEED); } else if (!naSrcAccountID.setAccountID(params[1u].asString())) {