20 #include <ripple/app/ledger/LedgerMaster.h>
21 #include <ripple/app/misc/HashRouter.h>
22 #include <ripple/app/misc/Transaction.h>
23 #include <ripple/app/tx/apply.h>
24 #include <ripple/net/RPCErr.h>
25 #include <ripple/protocol/ErrorCodes.h>
26 #include <ripple/resource/Fees.h>
27 #include <ripple/rpc/Context.h>
28 #include <ripple/rpc/GRPCHandlers.h>
29 #include <ripple/rpc/impl/RPCHelpers.h>
30 #include <ripple/rpc/impl/TransactionSign.h>
67 ret[jss::deprecated] =
68 "Signing support in the 'submit' command has been "
69 "deprecated and will be removed in a future version "
70 "of the server. Please migrate to a standalone "
80 if (!ret || !ret->size())
89 stpTrans = std::make_shared<STTx const>(
std::ref(sitTrans));
93 jvResult[jss::error] =
"invalidTransaction";
94 jvResult[jss::error_exception] = e.
what();
112 jvResult[jss::error] =
"invalidTransaction";
113 jvResult[jss::error_exception] =
"fails local checks: " + reason;
120 auto tpTrans = std::make_shared<Transaction>(stpTrans, reason, context.
app);
121 if (tpTrans->getStatus() !=
NEW)
123 jvResult[jss::error] =
"invalidTransaction";
124 jvResult[jss::error_exception] =
"fails local checks: " + reason;
138 jvResult[jss::error] =
"internalSubmit";
139 jvResult[jss::error_exception] = e.
what();
147 jvResult[jss::tx_blob] =
148 strHex(tpTrans->getSTransaction()->getSerializer().peekData());
157 jvResult[jss::engine_result] = sToken;
158 jvResult[jss::engine_result_code] = tpTrans->getResult();
159 jvResult[jss::engine_result_message] = sHuman;
161 auto const submitResult = tpTrans->getSubmitResult();
163 jvResult[jss::accepted] = submitResult.any();
164 jvResult[jss::applied] = submitResult.applied;
165 jvResult[jss::broadcast] = submitResult.broadcast;
166 jvResult[jss::queued] = submitResult.queued;
167 jvResult[jss::kept] = submitResult.kept;
169 if (
auto currentLedgerState = tpTrans->getCurrentLedgerState())
171 jvResult[jss::account_sequence_next] =
172 safe_cast<Json::Value::UInt>(
173 currentLedgerState->accountSeqNext);
174 jvResult[jss::account_sequence_available] =
175 safe_cast<Json::Value::UInt>(
176 currentLedgerState->accountSeqAvail);
177 jvResult[jss::open_ledger_cost] =
178 to_string(currentLedgerState->minFeeRequired);
179 jvResult[jss::validated_ledger_index] =
180 safe_cast<Json::Value::UInt>(
181 currentLedgerState->validatedLedger);
189 jvResult[jss::error] =
"internalJson";
190 jvResult[jss::error_exception] = e.
what();
virtual bool checkSigs() const =0
std::enable_if_t< std::is_same< T, char >::value||std::is_same< T, unsigned char >::value, Slice > makeSlice(std::array< T, N > const &a)
Json::Value rpcError(int iError)
const Charge feeMediumBurdenRPC
Resource::Charge & loadType
LedgerMaster & ledgerMaster
void forceValidity(HashRouter &router, uint256 const &txid, Validity validity)
Sets the validity of a given transaction in the cache.
@ SigGoodOnly
Signature is good, but local checks fail.
ProcessTransactionFn getProcessTxnFn(NetworkOPs &netOPs)
Json::Value transactionSubmit(Json::Value jvRequest, NetworkOPs::FailHard failType, Role role, std::chrono::seconds validatedLedgerAge, Application &app, ProcessTransactionFn const &processTransaction)
Returns a Json::objectValue.
std::pair< Validity, std::string > checkValidity(HashRouter &router, STTx const &tx, Rules const &rules, Config const &config)
Checks transaction signature and local checks.
Json::Value doSubmit(RPC::JsonContext &)
virtual Config & config()=0
virtual void processTransaction(std::shared_ptr< Transaction > &transaction, bool bUnlimited, bool bLocal, FailHard failType)=0
Process transactions as they arrive from the network or which are submitted by clients.
static NetworkOPs::FailHard getFailHard(RPC::JsonContext const &context)
bool isMember(const char *key) const
Return true if the object has a member named key.
std::shared_ptr< ReadView const > getCurrentLedger()
uint256 getTransactionID() const
bool isUnlimited(Role const &role)
ADMIN and IDENTIFIED roles shall have unlimited resources.
std::chrono::seconds getValidatedLedgerAge()
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
bool transResultInfo(TER code, std::string &token, std::string &text)
@ Valid
Signature and local checks are good / passed.
std::string to_string(Manifest const &m)
Format the specified manifest to a string for debugging purposes.
static FailHard doFailHard(bool noMeansDont)
std::string strHex(FwdIt begin, FwdIt end)
std::optional< Blob > strUnHex(std::size_t strSize, Iterator begin, Iterator end)
virtual HashRouter & getHashRouter()=0
Json::Value make_error(error_code_i code)
Returns a new json object that reflects the error code.
std::string asString() const
Returns the unquoted string value.