20 #include <ripple/app/ledger/LedgerMaster.h>
21 #include <ripple/app/main/Application.h>
22 #include <ripple/app/misc/HashRouter.h>
23 #include <ripple/app/misc/Transaction.h>
24 #include <ripple/app/rdb/backend/PostgresDatabase.h>
25 #include <ripple/app/rdb/backend/SQLiteDatabase.h>
26 #include <ripple/app/tx/apply.h>
27 #include <ripple/basics/Log.h>
28 #include <ripple/basics/safe_cast.h>
29 #include <ripple/core/DatabaseCon.h>
30 #include <ripple/core/Pg.h>
31 #include <ripple/json/json_reader.h>
32 #include <ripple/protocol/ErrorCodes.h>
33 #include <ripple/protocol/Feature.h>
34 #include <ripple/protocol/jss.h>
42 : mTransaction(stx), mApp(app), j_(app.journal(
"Ledger"))
46 mTransactionID = mTransaction->getTransactionID();
71 char const c = (status) ? (*status)[0] : safe_cast<char>(
txnSqlUnknown);
93 boost::optional<std::uint64_t>
const& ledgerSeq,
94 boost::optional<std::string>
const& status,
99 rangeCheckedCast<std::uint32_t>(ledgerSeq.value_or(0));
102 auto txn = std::make_shared<STTx const>(it);
104 auto tr = std::make_shared<Transaction>(txn, reason, app);
107 tr->setLedger(inLedger);
116 return load(
id, app, std::nullopt, ec);
141 Throw<std::runtime_error>(
"Failed to get relational database");
144 return db->locateTransaction(
id);
160 Throw<std::runtime_error>(
"Failed to get relational database");
163 return db->getTransaction(
id,
range, ec);
181 ret[jss::date] = ct->time_since_epoch().count();
static TransStatus sqlTransactionStatus(boost::optional< std::string > const &status)
static Transaction::pointer transactionFromSQL(boost::optional< std::uint64_t > const &ledgerSeq, boost::optional< std::string > const &status, Blob const &rawTxn, Application &app)
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 getJson(JsonOptions options, bool binary=false) const
std::shared_ptr< STTx const > mTransaction
Transaction(std::shared_ptr< STTx const > const &, std::string &, Application &) noexcept
virtual LedgerMaster & getLedgerMaster()=0
virtual RelationalDatabase & getRelationalDatabase()=0
static Locator locate(uint256 const &id, Application &app)
ClosedInterval< T > range(T low, T high)
Create a closed range interval.
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
static std::variant< std::pair< std::shared_ptr< Transaction >, std::shared_ptr< TxMeta > >, TxSearched > load(uint256 const &id, Application &app, error_code_i &ec)
std::optional< NetClock::time_point > getCloseTimeBySeq(LedgerIndex ledgerIndex)
void setStatus(TransStatus status, std::uint32_t ledgerSeq)
boost::icl::closed_interval< T > ClosedInterval
A closed interval over the domain T.