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>
68 ret[jss::deprecated] =
69 "Signing support in the 'submit' command has been "
70 "deprecated and will be removed in a future version "
71 "of the server. Please migrate to a standalone "
81 if (!ret || !ret->size())
90 stpTrans = std::make_shared<STTx const>(
std::ref(sitTrans));
94 jvResult[jss::error] =
"invalidTransaction";
95 jvResult[jss::error_exception] = e.
what();
113 jvResult[jss::error] =
"invalidTransaction";
114 jvResult[jss::error_exception] =
"fails local checks: " + reason;
121 auto tpTrans = std::make_shared<Transaction>(stpTrans, reason, context.
app);
122 if (tpTrans->getStatus() !=
NEW)
124 jvResult[jss::error] =
"invalidTransaction";
125 jvResult[jss::error_exception] =
"fails local checks: " + reason;
139 jvResult[jss::error] =
"internalSubmit";
140 jvResult[jss::error_exception] = e.
what();
148 jvResult[jss::tx_blob] =
149 strHex(tpTrans->getSTransaction()->getSerializer().peekData());
158 jvResult[jss::engine_result] = sToken;
159 jvResult[jss::engine_result_code] = tpTrans->getResult();
160 jvResult[jss::engine_result_message] = sHuman;
162 auto const submitResult = tpTrans->getSubmitResult();
164 jvResult[jss::accepted] = submitResult.any();
165 jvResult[jss::applied] = submitResult.applied;
166 jvResult[jss::broadcast] = submitResult.broadcast;
167 jvResult[jss::queued] = submitResult.queued;
168 jvResult[jss::kept] = submitResult.kept;
170 if (
auto currentLedgerState = tpTrans->getCurrentLedgerState())
172 jvResult[jss::account_sequence_next] =
173 safe_cast<Json::Value::UInt>(
174 currentLedgerState->accountSeqNext);
175 jvResult[jss::account_sequence_available] =
176 safe_cast<Json::Value::UInt>(
177 currentLedgerState->accountSeqAvail);
178 jvResult[jss::open_ledger_cost] =
179 to_string(currentLedgerState->minFeeRequired);
180 jvResult[jss::validated_ledger_index] =
181 safe_cast<Json::Value::UInt>(
182 currentLedgerState->validatedLedger);
190 jvResult[jss::error] =
"internalJson";
191 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)
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.
Json::Value transactionSubmit(Json::Value jvRequest, unsigned apiVersion, NetworkOPs::FailHard failType, Role role, std::chrono::seconds validatedLedgerAge, Application &app, ProcessTransactionFn const &processTransaction)
Returns a Json::objectValue.
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.