mirror of
https://github.com/XRPLF/rippled.git
synced 2025-11-26 22:15:52 +00:00
Make "offline" a parameter for RPC sign.
This commit is contained in:
@@ -78,6 +78,7 @@ Json::Value RPCHandler::transactionSign(Json::Value jvRequest, bool bSubmit, Sco
|
|||||||
Json::Value jvResult;
|
Json::Value jvResult;
|
||||||
RippleAddress naSeed;
|
RippleAddress naSeed;
|
||||||
RippleAddress raSrcAddressID;
|
RippleAddress raSrcAddressID;
|
||||||
|
bool bOffline = jvRequest.isMember("offline");
|
||||||
|
|
||||||
WriteLog (lsDEBUG, RPCHandler) << boost::str(boost::format("transactionSign: %s") % jvRequest);
|
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);
|
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 (!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")
|
WriteLog (lsDEBUG, RPCHandler) << boost::str(boost::format("transactionSign: Failed to find source account in current ledger: %s")
|
||||||
% raSrcAddressID.humanAccountID());
|
% raSrcAddressID.humanAccountID());
|
||||||
|
|
||||||
@@ -217,6 +220,7 @@ Json::Value RPCHandler::transactionSign(Json::Value jvRequest, bool bSubmit, Sco
|
|||||||
{
|
{
|
||||||
if (bOffline)
|
if (bOffline)
|
||||||
{
|
{
|
||||||
|
// If offline, Sequence is mandatory.
|
||||||
return rpcError(rpcINVALID_PARAMS);
|
return rpcError(rpcINVALID_PARAMS);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|||||||
Reference in New Issue
Block a user