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/RelationalDBInterface_postgres.h>
25 #include <ripple/app/rdb/backend/RelationalDBInterfacePostgres.h>
26 #include <ripple/app/rdb/backend/RelationalDBInterfaceSqlite.h>
27 #include <ripple/app/tx/apply.h>
28 #include <ripple/basics/Log.h>
29 #include <ripple/basics/safe_cast.h>
30 #include <ripple/core/DatabaseCon.h>
31 #include <ripple/core/Pg.h>
32 #include <ripple/json/json_reader.h>
33 #include <ripple/protocol/ErrorCodes.h>
34 #include <ripple/protocol/Feature.h>
35 #include <ripple/protocol/jss.h>
43 : mTransaction(stx), mApp(app), j_(app.journal(
"Ledger"))
47 mTransactionID = mTransaction->getTransactionID();
72 char const c = (status) ? (*status)[0] : safe_cast<char>(
txnSqlUnknown);
94 boost::optional<std::uint64_t>
const& ledgerSeq,
95 boost::optional<std::string>
const& status,
100 rangeCheckedCast<std::uint32_t>(ledgerSeq.value_or(0));
103 auto txn = std::make_shared<STTx const>(it);
105 auto tr = std::make_shared<Transaction>(txn, reason, app);
108 tr->setLedger(inLedger);
117 return load(
id, app, std::nullopt, ec);
171 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
virtual RelationalDBInterface & getRelationalDBInterface()=0
Transaction::Locator locateTransaction(std::shared_ptr< PgPool > const &pgPool, uint256 const &id, Application &app)
locateTransaction Returns information used to locate a transaction.
std::shared_ptr< STTx const > mTransaction
Transaction(std::shared_ptr< STTx const > const &, std::string &, Application &) noexcept
virtual LedgerMaster & getLedgerMaster()=0
static Locator locate(uint256 const &id, Application &app)
ClosedInterval< T > range(T low, T high)
Create a closed range interval.
std::variant< RelationalDBInterface::AccountTx, TxSearched > getTransaction(soci::session &session, Application &app, uint256 const &id, std::optional< ClosedInterval< uint32_t >> const &range, error_code_i &ec)
getTransaction Returns transaction with given hash.
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.