From 12dd03ff65bbc8f6957f7dafcbfdfcdd38efa0b5 Mon Sep 17 00:00:00 2001 From: Arthur Britto Date: Sat, 8 Jun 2013 17:40:33 -0700 Subject: [PATCH] Make "offline" a parameter for RPC sign. --- src/cpp/ripple/RPCHandler.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/cpp/ripple/RPCHandler.cpp b/src/cpp/ripple/RPCHandler.cpp index 4edd35baca..ea1931e2b7 100644 --- a/src/cpp/ripple/RPCHandler.cpp +++ b/src/cpp/ripple/RPCHandler.cpp @@ -78,6 +78,7 @@ Json::Value RPCHandler::transactionSign(Json::Value jvRequest, bool bSubmit, Sco Json::Value jvResult; RippleAddress naSeed; RippleAddress raSrcAddressID; + bool bOffline = jvRequest.isMember("offline"); WriteLog (lsDEBUG, RPCHandler) << boost::str(boost::format("transactionSign: %s") % jvRequest); @@ -109,11 +110,13 @@ Json::Value RPCHandler::transactionSign(Json::Value jvRequest, bool bSubmit, Sco return rpcError(rpcINVALID_PARAMS); } - bool bOffline = mNetOps->getOperatingMode() < NetworkOPs::omSYNCING; + AccountState::pointer asSrc = bOffline + ? AccountState::pointer() // Don't look up address if offline. + : mNetOps->getAccountState(mNetOps->getCurrentSnapshot(), raSrcAddressID); - AccountState::pointer asSrc = bOffline ? AccountState::pointer() : mNetOps->getAccountState(mNetOps->getCurrentSnapshot(), raSrcAddressID); if (!bOffline && !asSrc) { + // If not offline and did not find account, error. WriteLog (lsDEBUG, RPCHandler) << boost::str(boost::format("transactionSign: Failed to find source account in current ledger: %s") % raSrcAddressID.humanAccountID()); @@ -217,6 +220,7 @@ Json::Value RPCHandler::transactionSign(Json::Value jvRequest, bool bSubmit, Sco { if (bOffline) { + // If offline, Sequence is mandatory. return rpcError(rpcINVALID_PARAMS); } else