rippled
Loading...
Searching...
No Matches
AccountTxPaging.cpp
1#include <xrpld/app/ledger/LedgerMaster.h>
2#include <xrpld/app/ledger/LedgerPersistence.h>
3#include <xrpld/app/main/Application.h>
4#include <xrpld/app/misc/Transaction.h>
5#include <xrpld/app/misc/detail/AccountTxPaging.h>
6
7#include <xrpl/core/NetworkIDService.h>
8#include <xrpl/protocol/Serializer.h>
9
10namespace xrpl {
11
12void
15 std::uint32_t ledger_index,
16 std::string const& status,
17 Blob const& rawTxn,
18 Blob const& rawMeta,
19 Application& app)
20{
21 SerialIter it(makeSlice(rawTxn));
22 auto txn = std::make_shared<STTx const>(it);
23 std::string reason;
24
25 auto tr = std::make_shared<Transaction>(txn, reason, app);
26
27 auto metaset = std::make_shared<TxMeta>(tr->getID(), ledger_index, rawMeta);
28
29 // if properly formed meta is available we can use it to generate ctid
30 if (metaset->getAsObject().isFieldPresent(sfTransactionIndex))
31 {
32 tr->setStatus(
34 ledger_index,
35 metaset->getAsObject().getFieldU32(sfTransactionIndex),
37 }
38 else
39 {
40 tr->setStatus(Transaction::sqlTransactionStatus(status), ledger_index);
41 }
42
43 to.emplace_back(std::move(tr), metaset);
44};
45
46void
48{
49 if (auto l = app.getLedgerMaster().getLedgerBySeq(seq))
50 pendSaveValidated(app, l, false, false);
51}
52
53} // namespace xrpl
std::shared_ptr< Ledger const > getLedgerBySeq(std::uint32_t index)
virtual std::uint32_t getNetworkID() const noexcept=0
Get the configured network ID.
virtual NetworkIDService & getNetworkIDService()=0
virtual LedgerMaster & getLedgerMaster()=0
static TransStatus sqlTransactionStatus(boost::optional< std::string > const &status)
T emplace_back(T... args)
T is_same_v
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
Definition algorithm.h:5
void saveLedgerAsync(Application &app, std::uint32_t seq)
bool pendSaveValidated(ServiceRegistry &registry, std::shared_ptr< Ledger const > const &ledger, bool isSynchronous, bool isCurrent)
Save, or arrange to save, a fully-validated ledger.
void convertBlobsToTxResult(RelationalDatabase::AccountTxs &to, std::uint32_t ledger_index, std::string const &status, Blob const &rawTxn, Blob const &rawMeta, 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)
Definition Slice.h:215