rippled
AccountTx.cpp
1 //------------------------------------------------------------------------------
2 /*
3  This file is part of rippled: https://github.com/ripple/rippled
4  Copyright (c) 2012-2014 Ripple Labs Inc.
5 
6  Permission to use, copy, modify, and/or distribute this software for any
7  purpose with or without fee is hereby granted, provided that the above
8  copyright notice and this permission notice appear in all copies.
9 
10  THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
11  WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
12  MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
13  ANY SPECIAL , DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
14  WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
15  ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
16  OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
17 */
18 //==============================================================================
19 
20 #include <ripple/app/ledger/LedgerMaster.h>
21 #include <ripple/app/main/Application.h>
22 #include <ripple/app/misc/NetworkOPs.h>
23 #include <ripple/app/misc/Transaction.h>
24 #include <ripple/app/rdb/backend/RelationalDBInterfacePostgres.h>
25 #include <ripple/app/rdb/backend/RelationalDBInterfaceSqlite.h>
26 #include <ripple/core/Pg.h>
27 #include <ripple/json/json_reader.h>
28 #include <ripple/json/json_value.h>
29 #include <ripple/ledger/ReadView.h>
30 #include <ripple/net/RPCErr.h>
31 #include <ripple/protocol/ErrorCodes.h>
32 #include <ripple/protocol/UintTypes.h>
33 #include <ripple/protocol/jss.h>
34 #include <ripple/resource/Fees.h>
35 #include <ripple/rpc/Context.h>
36 #include <ripple/rpc/DeliveredAmount.h>
37 #include <ripple/rpc/Role.h>
38 #include <ripple/rpc/impl/GRPCHelpers.h>
39 #include <ripple/rpc/impl/RPCHelpers.h>
40 
41 #include <grpcpp/grpcpp.h>
42 
43 namespace ripple {
44 
50 
53 
54 // parses args into a ledger specifier, or returns a grpc status object on error
57  org::xrpl::rpc::v1::GetAccountTransactionHistoryRequest const& params)
58 {
59  grpc::Status status;
60  if (params.has_ledger_range())
61  {
62  uint32_t min = params.ledger_range().ledger_index_min();
63  uint32_t max = params.ledger_range().ledger_index_max();
64 
65  // if min is set but not max, need to set max
66  if (min != 0 && max == 0)
67  {
68  max = UINT32_MAX;
69  }
70 
71  return LedgerRange{min, max};
72  }
73  else if (params.has_ledger_specifier())
74  {
75  LedgerSpecifier ledger;
76 
77  auto& specifier = params.ledger_specifier();
78  using LedgerCase = org::xrpl::rpc::v1::LedgerSpecifier::LedgerCase;
79  LedgerCase ledgerCase = specifier.ledger_case();
80 
81  if (ledgerCase == LedgerCase::kShortcut)
82  {
83  using LedgerSpecifier = org::xrpl::rpc::v1::LedgerSpecifier;
84 
85  if (specifier.shortcut() == LedgerSpecifier::SHORTCUT_VALIDATED)
86  ledger = LedgerShortcut::VALIDATED;
87  else if (specifier.shortcut() == LedgerSpecifier::SHORTCUT_CLOSED)
88  ledger = LedgerShortcut::CLOSED;
89  else if (specifier.shortcut() == LedgerSpecifier::SHORTCUT_CURRENT)
90  ledger = LedgerShortcut::CURRENT;
91  else
92  return {};
93  }
94  else if (ledgerCase == LedgerCase::kSequence)
95  {
96  ledger = specifier.sequence();
97  }
98  else if (ledgerCase == LedgerCase::kHash)
99  {
100  if (uint256::size() != specifier.hash().size())
101  {
102  grpc::Status errorStatus{
103  grpc::StatusCode::INVALID_ARGUMENT,
104  "ledger hash malformed"};
105  return errorStatus;
106  }
107  ledger = uint256::fromVoid(specifier.hash().data());
108  }
109  return ledger;
110  }
112 }
113 
114 // parses args into a ledger specifier, or returns a Json object on error
117 {
118  Json::Value response;
119  if (params.isMember(jss::ledger_index_min) ||
120  params.isMember(jss::ledger_index_max))
121  {
122  uint32_t min = params.isMember(jss::ledger_index_min) &&
123  params[jss::ledger_index_min].asInt() >= 0
124  ? params[jss::ledger_index_min].asUInt()
125  : 0;
126  uint32_t max = params.isMember(jss::ledger_index_max) &&
127  params[jss::ledger_index_max].asInt() >= 0
128  ? params[jss::ledger_index_max].asUInt()
129  : UINT32_MAX;
130 
131  return LedgerRange{min, max};
132  }
133  else if (params.isMember(jss::ledger_hash))
134  {
135  auto& hashValue = params[jss::ledger_hash];
136  if (!hashValue.isString())
137  {
138  RPC::Status status{rpcINVALID_PARAMS, "ledgerHashNotString"};
139  status.inject(response);
140  return response;
141  }
142 
143  LedgerHash hash;
144  if (!hash.parseHex(hashValue.asString()))
145  {
146  RPC::Status status{rpcINVALID_PARAMS, "ledgerHashMalformed"};
147  status.inject(response);
148  return response;
149  }
150  return hash;
151  }
152  else if (params.isMember(jss::ledger_index))
153  {
154  LedgerSpecifier ledger;
155  if (params[jss::ledger_index].isNumeric())
156  ledger = params[jss::ledger_index].asUInt();
157  else
158  {
159  std::string ledgerStr = params[jss::ledger_index].asString();
160 
161  if (ledgerStr == "current" || ledgerStr.empty())
162  ledger = LedgerShortcut::CURRENT;
163  else if (ledgerStr == "closed")
164  ledger = LedgerShortcut::CLOSED;
165  else if (ledgerStr == "validated")
166  ledger = LedgerShortcut::VALIDATED;
167  else
168  {
169  RPC::Status status{
170  rpcINVALID_PARAMS, "ledger_index string malformed"};
171  status.inject(response);
172  return response;
173  }
174  }
175  return ledger;
176  }
178 }
179 
182  RPC::Context& context,
183  std::optional<LedgerSpecifier> const& ledgerSpecifier)
184 {
185  std::uint32_t uValidatedMin;
186  std::uint32_t uValidatedMax;
187  bool bValidated =
188  context.ledgerMaster.getValidatedRange(uValidatedMin, uValidatedMax);
189 
190  if (!bValidated)
191  {
192  // Don't have a validated ledger range.
193  if (context.apiVersion == 1)
194  return rpcLGR_IDXS_INVALID;
195  return rpcNOT_SYNCED;
196  }
197 
198  std::uint32_t uLedgerMin = uValidatedMin;
199  std::uint32_t uLedgerMax = uValidatedMax;
200  // Does request specify a ledger or ledger range?
201  if (ledgerSpecifier)
202  {
203  auto const status = std::visit(
204  [&](auto const& ls) -> RPC::Status {
205  using T = std::decay_t<decltype(ls)>;
206  if constexpr (std::is_same_v<T, LedgerRange>)
207  {
208  if (ls.min > uValidatedMin)
209  {
210  uLedgerMin = ls.min;
211  }
212  if (ls.max < uValidatedMax)
213  {
214  uLedgerMax = ls.max;
215  }
216  if (uLedgerMax < uLedgerMin)
217  {
218  if (context.apiVersion == 1)
219  return rpcLGR_IDXS_INVALID;
220  return rpcINVALID_LGR_RANGE;
221  }
222  }
223  else
224  {
226  auto const status = getLedger(ledgerView, ls, context);
227  if (!ledgerView)
228  {
229  return status;
230  }
231 
232  bool validated = RPC::isValidated(
233  context.ledgerMaster, *ledgerView, context.app);
234 
235  if (!validated || ledgerView->info().seq > uValidatedMax ||
236  ledgerView->info().seq < uValidatedMin)
237  {
238  return rpcLGR_NOT_VALIDATED;
239  }
240  uLedgerMin = uLedgerMax = ledgerView->info().seq;
241  }
242  return RPC::Status::OK;
243  },
244  *ledgerSpecifier);
245 
246  if (status)
247  return status;
248  }
249  return LedgerRange{uLedgerMin, uLedgerMax};
250 }
251 
254 {
256  if (context.app.config().reporting())
257  return dynamic_cast<RelationalDBInterfacePostgres*>(
258  &context.app.getRelationalDBInterface())
259  ->getAccountTx(args);
260 
261  AccountTxResult result;
262 
263  auto lgrRange = getLedgerRange(context, args.ledger);
264  if (auto stat = std::get_if<RPC::Status>(&lgrRange))
265  {
266  // An error occurred getting the requested ledger range
267  return {result, *stat};
268  }
269 
270  result.ledgerRange = std::get<LedgerRange>(lgrRange);
271 
272  result.marker = args.marker;
273 
275  args.account,
276  result.ledgerRange.min,
277  result.ledgerRange.max,
278  result.marker,
279  args.limit,
280  isUnlimited(context.role)};
281 
282  if (args.binary)
283  {
284  if (args.forward)
285  {
286  auto [tx, marker] = dynamic_cast<RelationalDBInterfaceSqlite*>(
287  &context.app.getRelationalDBInterface())
288  ->oldestAccountTxPageB(options);
289  result.transactions = tx;
290  result.marker = marker;
291  }
292  else
293  {
294  auto [tx, marker] = dynamic_cast<RelationalDBInterfaceSqlite*>(
295  &context.app.getRelationalDBInterface())
296  ->newestAccountTxPageB(options);
297  result.transactions = tx;
298  result.marker = marker;
299  }
300  }
301  else
302  {
303  if (args.forward)
304  {
305  auto [tx, marker] = dynamic_cast<RelationalDBInterfaceSqlite*>(
306  &context.app.getRelationalDBInterface())
307  ->oldestAccountTxPage(options);
308  result.transactions = tx;
309  result.marker = marker;
310  }
311  else
312  {
313  auto [tx, marker] = dynamic_cast<RelationalDBInterfaceSqlite*>(
314  &context.app.getRelationalDBInterface())
315  ->newestAccountTxPage(options);
316  result.transactions = tx;
317  result.marker = marker;
318  }
319  }
320 
321  result.limit = args.limit;
322  JLOG(context.j.debug()) << __func__ << " : finished";
323 
324  return {result, rpcSUCCESS};
325 }
326 
327 std::pair<
328  org::xrpl::rpc::v1::GetAccountTransactionHistoryResponse,
329  grpc::Status>
332  AccountTxArgs const& args,
334  org::xrpl::rpc::v1::GetAccountTransactionHistoryRequest> const& context)
335 {
336  org::xrpl::rpc::v1::GetAccountTransactionHistoryResponse response;
337  grpc::Status status = grpc::Status::OK;
338 
339  RPC::Status const& error = res.second;
340  if (error.toErrorCode() != rpcSUCCESS)
341  {
342  if (error.toErrorCode() == rpcLGR_NOT_FOUND)
343  {
344  status = {grpc::StatusCode::NOT_FOUND, error.message()};
345  }
346  else if (error.toErrorCode() == rpcNOT_SYNCED)
347  {
348  status = {grpc::StatusCode::FAILED_PRECONDITION, error.message()};
349  }
350  else
351  {
352  status = {grpc::StatusCode::INVALID_ARGUMENT, error.message()};
353  }
354  }
355  else
356  {
357  AccountTxResult const& result = res.first;
358 
359  // account_tx always returns validated data
360  response.set_validated(true);
361  response.set_limit(result.limit);
362  response.mutable_account()->set_address(
363  context.params.account().address());
364  response.set_ledger_index_min(result.ledgerRange.min);
365  response.set_ledger_index_max(result.ledgerRange.max);
366 
367  if (auto txnsData = std::get_if<TxnsData>(&result.transactions))
368  {
369  assert(!args.binary);
370  for (auto const& [txn, txnMeta] : *txnsData)
371  {
372  if (txn)
373  {
374  auto txnProto = response.add_transactions();
375 
376  RPC::convert(
377  *txnProto->mutable_transaction(),
378  txn->getSTransaction());
379 
380  // account_tx always returns validated data
381  txnProto->set_validated(true);
382  txnProto->set_ledger_index(txn->getLedger());
383  auto& hash = txn->getID();
384  txnProto->set_hash(hash.data(), hash.size());
385  auto closeTime =
386  context.app.getLedgerMaster().getCloseTimeBySeq(
387  txn->getLedger());
388  if (closeTime)
389  txnProto->mutable_date()->set_value(
390  closeTime->time_since_epoch().count());
391  if (txnMeta)
392  {
393  RPC::convert(*txnProto->mutable_meta(), txnMeta);
394  if (!txnProto->meta().has_delivered_amount())
395  {
396  if (auto amt = getDeliveredAmount(
397  context,
398  txn->getSTransaction(),
399  *txnMeta,
400  txn->getLedger()))
401  {
402  RPC::convert(
403  *txnProto->mutable_meta()
404  ->mutable_delivered_amount(),
405  *amt);
406  }
407  }
408  }
409  }
410  }
411  }
412  else
413  {
414  assert(args.binary);
415 
416  for (auto const& binaryData :
417  std::get<TxnsDataBinary>(result.transactions))
418  {
419  auto txnProto = response.add_transactions();
420  Blob const& txnBlob = std::get<0>(binaryData);
421  txnProto->set_transaction_binary(
422  txnBlob.data(), txnBlob.size());
423 
424  Blob const& metaBlob = std::get<1>(binaryData);
425  txnProto->set_meta_binary(metaBlob.data(), metaBlob.size());
426 
427  txnProto->set_ledger_index(std::get<2>(binaryData));
428 
429  // account_tx always returns validated data
430  txnProto->set_validated(true);
431 
432  auto closeTime =
433  context.app.getLedgerMaster().getCloseTimeBySeq(
434  std::get<2>(binaryData));
435  if (closeTime)
436  txnProto->mutable_date()->set_value(
437  closeTime->time_since_epoch().count());
438  }
439  }
440 
441  if (result.marker)
442  {
443  response.mutable_marker()->set_ledger_index(
444  result.marker->ledgerSeq);
445  response.mutable_marker()->set_account_sequence(
446  result.marker->txnSeq);
447  }
448  }
449  return {response, status};
450 }
451 
455  AccountTxArgs const& args,
456  RPC::JsonContext const& context)
457 {
458  Json::Value response;
459  RPC::Status const& error = res.second;
460  if (error.toErrorCode() != rpcSUCCESS)
461  {
462  error.inject(response);
463  }
464  else
465  {
466  AccountTxResult const& result = res.first;
467  response[jss::validated] = true;
468  response[jss::limit] = result.limit;
469  response[jss::account] = context.params[jss::account].asString();
470  response[jss::ledger_index_min] = result.ledgerRange.min;
471  response[jss::ledger_index_max] = result.ledgerRange.max;
472 
473  Json::Value& jvTxns = (response[jss::transactions] = Json::arrayValue);
474 
475  if (auto txnsData = std::get_if<TxnsData>(&result.transactions))
476  {
477  assert(!args.binary);
478  for (auto const& [txn, txnMeta] : *txnsData)
479  {
480  if (txn)
481  {
482  Json::Value& jvObj = jvTxns.append(Json::objectValue);
483 
484  jvObj[jss::tx] = txn->getJson(JsonOptions::include_date);
485  if (txnMeta)
486  {
487  jvObj[jss::meta] =
488  txnMeta->getJson(JsonOptions::include_date);
489  jvObj[jss::validated] = true;
490  insertDeliveredAmount(
491  jvObj[jss::meta], context, txn, *txnMeta);
492  }
493  }
494  }
495  }
496  else
497  {
498  assert(args.binary);
499 
500  for (auto const& binaryData :
501  std::get<TxnsDataBinary>(result.transactions))
502  {
503  Json::Value& jvObj = jvTxns.append(Json::objectValue);
504 
505  jvObj[jss::tx_blob] = strHex(std::get<0>(binaryData));
506  jvObj[jss::meta] = strHex(std::get<1>(binaryData));
507  jvObj[jss::ledger_index] = std::get<2>(binaryData);
508  jvObj[jss::validated] = true;
509  }
510  }
511 
512  if (result.marker)
513  {
514  response[jss::marker] = Json::objectValue;
515  response[jss::marker][jss::ledger] = result.marker->ledgerSeq;
516  response[jss::marker][jss::seq] = result.marker->txnSeq;
517  }
518  if (context.app.config().reporting())
519  response["used_postgres"] = true;
520  }
521 
522  JLOG(context.j.debug()) << __func__ << " : finished";
523  return response;
524 }
525 
526 // {
527 // account: account,
528 // ledger_index_min: ledger_index // optional, defaults to earliest
529 // ledger_index_max: ledger_index, // optional, defaults to latest
530 // binary: boolean, // optional, defaults to false
531 // forward: boolean, // optional, defaults to false
532 // limit: integer, // optional
533 // marker: object {ledger: ledger_index, seq: txn_sequence} // optional,
534 // resume previous query
535 // }
538 {
539  if (!context.app.config().useTxTables())
540  return rpcError(rpcNOT_ENABLED);
541 
542  auto& params = context.params;
543  AccountTxArgs args;
544  Json::Value response;
545 
546  args.limit = params.isMember(jss::limit) ? params[jss::limit].asUInt() : 0;
547  args.binary = params.isMember(jss::binary) && params[jss::binary].asBool();
548  args.forward =
549  params.isMember(jss::forward) && params[jss::forward].asBool();
550 
551  if (!params.isMember(jss::account))
552  return rpcError(rpcINVALID_PARAMS);
553 
554  auto const account =
555  parseBase58<AccountID>(params[jss::account].asString());
556  if (!account)
557  return rpcError(rpcACT_MALFORMED);
558 
559  args.account = *account;
560 
561  auto parseRes = parseLedgerArgs(params);
562  if (auto jv = std::get_if<Json::Value>(&parseRes))
563  {
564  return *jv;
565  }
566  else
567  {
568  args.ledger = std::get<std::optional<LedgerSpecifier>>(parseRes);
569  }
570 
571  if (params.isMember(jss::marker))
572  {
573  auto& token = params[jss::marker];
574  if (!token.isMember(jss::ledger) || !token.isMember(jss::seq) ||
575  !token[jss::ledger].isConvertibleTo(Json::ValueType::uintValue) ||
576  !token[jss::seq].isConvertibleTo(Json::ValueType::uintValue))
577  {
578  RPC::Status status{
580  "invalid marker. Provide ledger index via ledger field, and "
581  "transaction sequence number via seq field"};
582  status.inject(response);
583  return response;
584  }
585  args.marker = {token[jss::ledger].asUInt(), token[jss::seq].asUInt()};
586  }
587 
588  auto res = doAccountTxHelp(context, args);
589  JLOG(context.j.debug()) << __func__ << " populating response";
590  return populateJsonResponse(res, args, context);
591 }
592 
593 std::pair<
594  org::xrpl::rpc::v1::GetAccountTransactionHistoryResponse,
595  grpc::Status>
598  context)
599 {
600  if (!context.app.config().useTxTables())
601  {
602  return {
603  {},
604  {grpc::StatusCode::UNIMPLEMENTED, "Not enabled in configuration."}};
605  }
606 
607  // return values
608  org::xrpl::rpc::v1::GetAccountTransactionHistoryResponse response;
609  grpc::Status status = grpc::Status::OK;
610  AccountTxArgs args;
611 
612  auto& request = context.params;
613 
614  auto const account = parseBase58<AccountID>(request.account().address());
615  if (!account)
616  {
617  return {
618  {},
619  {grpc::StatusCode::INVALID_ARGUMENT, "Could not decode account"}};
620  }
621 
622  args.account = *account;
623  args.limit = request.limit();
624  args.binary = request.binary();
625  args.forward = request.forward();
626 
627  if (request.has_marker())
628  {
629  args.marker = {
630  request.marker().ledger_index(),
631  request.marker().account_sequence()};
632  }
633 
634  auto parseRes = parseLedgerArgs(request);
635  if (auto stat = std::get_if<grpc::Status>(&parseRes))
636  {
637  return {response, *stat};
638  }
639  else
640  {
641  args.ledger = std::get<std::optional<LedgerSpecifier>>(parseRes);
642  }
643 
644  auto res = doAccountTxHelp(context, args);
645  return populateProtoResponse(res, args, context);
646 }
647 
648 } // namespace ripple
ripple::ReadView::info
virtual LedgerInfo const & info() const =0
Returns information about the ledger.
ripple::LedgerMaster::getValidatedRange
bool getValidatedRange(std::uint32_t &minVal, std::uint32_t &maxVal)
Definition: LedgerMaster.cpp:621
ripple::RPC::Status::OK
static constexpr Code OK
Definition: Status.h:46
ripple::JsonOptions::include_date
@ include_date
ripple::RPC::JsonContext
Definition: Context.h:53
ripple::RelationalDBInterface::AccountTxArgs
Definition: RelationalDBInterface.h:96
ripple::getAccountTx
std::pair< AccountTxResult, RPC::Status > getAccountTx(std::shared_ptr< PgPool > const &pgPool, AccountTxArgs const &args, Application &app, beast::Journal j)
getAccountTx Get last account transactions specifies by passed argumenrs structure.
Definition: RelationalDBInterface_postgres.cpp:542
ripple::rpcLGR_IDXS_INVALID
@ rpcLGR_IDXS_INVALID
Definition: ErrorCodes.h:112
std::string
STL class.
std::shared_ptr
STL class.
ripple::rpcINVALID_PARAMS
@ rpcINVALID_PARAMS
Definition: ErrorCodes.h:84
ripple::Resource::feeMediumBurdenRPC
const Charge feeMediumBurdenRPC
Json::arrayValue
@ arrayValue
array value (ordered list)
Definition: json_value.h:42
std::pair
ripple::RPC::LedgerShortcut
LedgerShortcut
Definition: RPCHelpers.h:109
ripple::RPC::Context::loadType
Resource::Charge & loadType
Definition: Context.h:43
std::vector< unsigned char >
std::vector::size
T size(T... args)
ripple::Application::getRelationalDBInterface
virtual RelationalDBInterface & getRelationalDBInterface()=0
ripple::populateProtoResponse
std::pair< org::xrpl::rpc::v1::GetAccountTransactionHistoryResponse, grpc::Status > populateProtoResponse(std::pair< AccountTxResult, RPC::Status > const &res, AccountTxArgs const &args, RPC::GRPCContext< org::xrpl::rpc::v1::GetAccountTransactionHistoryRequest > const &context)
Definition: AccountTx.cpp:330
ripple::RelationalDBInterface::AccountTxResult
Definition: RelationalDBInterface.h:106
ripple::doAccountTxGrpc
std::pair< org::xrpl::rpc::v1::GetAccountTransactionHistoryResponse, grpc::Status > doAccountTxGrpc(RPC::GRPCContext< org::xrpl::rpc::v1::GetAccountTransactionHistoryRequest > &context)
Definition: AccountTx.cpp:596
ripple::RelationalDBInterface::AccountTxArgs::marker
std::optional< AccountTxMarker > marker
Definition: RelationalDBInterface.h:103
ripple::RPC::Context::ledgerMaster
LedgerMaster & ledgerMaster
Definition: Context.h:45
ripple::newestAccountTxPage
std::pair< std::optional< RelationalDBInterface::AccountTxMarker >, int > newestAccountTxPage(soci::session &session, AccountIDCache const &idCache, std::function< void(std::uint32_t)> const &onUnsavedLedger, std::function< void(std::uint32_t, std::string const &, Blob &&, Blob &&)> const &onTransaction, RelationalDBInterface::AccountTxPageOptions const &options, int limit_used, std::uint32_t page_length)
newestAccountTxPage Searches newest transactions for given account which match given criteria startin...
Definition: RelationalDBInterface_nodes.cpp:1239
std::tuple
ripple::RelationalDBInterface::AccountTxArgs::ledger
std::optional< LedgerSpecifier > ledger
Definition: RelationalDBInterface.h:99
ripple::LedgerInfo::seq
LedgerIndex seq
Definition: ReadView.h:92
ripple::RPC::Context::role
Role role
Definition: Context.h:47
ripple::rpcLGR_NOT_FOUND
@ rpcLGR_NOT_FOUND
Definition: ErrorCodes.h:72
ripple::RelationalDBInterfacePostgres
Definition: RelationalDBInterfacePostgres.h:27
ripple::base_uint< 256 >::size
constexpr static std::size_t size()
Definition: base_uint.h:495
ripple::RelationalDBInterface::AccountTxArgs::binary
bool binary
Definition: RelationalDBInterface.h:100
ripple::doAccountTxHelp
std::pair< AccountTxResult, RPC::Status > doAccountTxHelp(RPC::Context &context, AccountTxArgs const &args)
Definition: AccountTx.cpp:253
ripple::RPC::Context::j
const beast::Journal j
Definition: Context.h:41
ripple::getLedgerRange
std::variant< LedgerRange, RPC::Status > getLedgerRange(RPC::Context &context, std::optional< LedgerSpecifier > const &ledgerSpecifier)
Definition: AccountTx.cpp:181
ripple::RelationalDBInterface::LedgerSpecifier
std::variant< LedgerRange, LedgerShortcut, LedgerSequence, LedgerHash > LedgerSpecifier
Definition: RelationalDBInterface.h:94
ripple::RelationalDBInterface::AccountTxResult::transactions
std::variant< AccountTxs, MetaTxsList > transactions
Definition: RelationalDBInterface.h:108
ripple::base_uint< 256 >
ripple::RPC::convert
void convert(org::xrpl::rpc::v1::TransactionResult &to, TER from)
Definition: GRPCHelpers.cpp:961
ripple::rpcSUCCESS
@ rpcSUCCESS
Definition: ErrorCodes.h:44
Json::Value::append
Value & append(const Value &value)
Append value to array at the end.
Definition: json_value.cpp:882
ripple::Config::reporting
bool reporting() const
Definition: Config.h:276
ripple::RelationalDBInterface::AccountTxResult::ledgerRange
LedgerRange ledgerRange
Definition: RelationalDBInterface.h:109
ripple::RelationalDBInterface::LedgerShortcut
RPC::LedgerShortcut LedgerShortcut
Definition: RelationalDBInterface.h:92
Json::objectValue
@ objectValue
object value (collection of name/value pairs).
Definition: json_value.h:43
ripple::RelationalDBInterfaceSqlite
Definition: RelationalDBInterfaceSqlite.h:27
ripple::Application::config
virtual Config & config()=0
ripple::RPC::GRPCContext
Definition: Context.h:70
ripple::Config::useTxTables
bool useTxTables() const
Definition: Config.h:282
ripple::RPC::Context::app
Application & app
Definition: Context.h:42
ripple::rpcNOT_ENABLED
@ rpcNOT_ENABLED
Definition: ErrorCodes.h:59
Json::Value::isMember
bool isMember(const char *key) const
Return true if the object has a member named key.
Definition: json_value.cpp:932
std::uint32_t
ripple::rpcError
Json::Value rpcError(int iError, Json::Value jvResult)
Definition: RPCErr.cpp:29
ripple::RPC::Status
Status represents the results of an operation that might fail.
Definition: Status.h:39
ripple::RelationalDBInterface::AccountTxArgs::limit
uint32_t limit
Definition: RelationalDBInterface.h:102
std::decay_t
ripple::isUnlimited
bool isUnlimited(Role const &role)
ADMIN and IDENTIFIED roles shall have unlimited resources.
Definition: Role.cpp:94
ripple::RPC::GRPCContext::params
RequestType params
Definition: Context.h:72
ripple
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
Definition: RCLCensorshipDetector.h:29
ripple::populateJsonResponse
Json::Value populateJsonResponse(std::pair< AccountTxResult, RPC::Status > const &res, AccountTxArgs const &args, RPC::JsonContext const &context)
Definition: AccountTx.cpp:453
ripple::RPC::isValidated
bool isValidated(LedgerMaster &ledgerMaster, ReadView const &ledger, Application &app)
Definition: RPCHelpers.cpp:465
ripple::RelationalDBInterface::AccountTxArgs::account
AccountID account
Definition: RelationalDBInterface.h:98
ripple::rpcACT_MALFORMED
@ rpcACT_MALFORMED
Definition: ErrorCodes.h:90
ripple::TxnsData
RelationalDBInterface::AccountTxs TxnsData
Definition: RelationalDBInterface_postgres.cpp:27
ripple::rpcLGR_NOT_VALIDATED
@ rpcLGR_NOT_VALIDATED
Definition: ErrorCodes.h:73
ripple::RelationalDBInterface::MetaTxsList
std::vector< txnMetaLedgerType > MetaTxsList
Definition: RelationalDBInterface.h:88
ripple::doAccountTxJson
Json::Value doAccountTxJson(RPC::JsonContext &context)
Definition: AccountTx.cpp:537
ripple::base_uint< 256 >::fromVoid
static base_uint fromVoid(void const *data)
Definition: base_uint.h:311
ripple::LedgerRange::max
uint32_t max
Definition: RelationalDBInterface.h:45
Json::Value::asUInt
UInt asUInt() const
Definition: json_value.cpp:545
ripple::RPC::Context::apiVersion
unsigned int apiVersion
Definition: Context.h:50
ripple::RelationalDBInterface::AccountTxResult::limit
uint32_t limit
Definition: RelationalDBInterface.h:110
ripple::RelationalDBInterface::AccountTxResult::marker
std::optional< AccountTxMarker > marker
Definition: RelationalDBInterface.h:111
ripple::oldestAccountTxPage
std::pair< std::optional< RelationalDBInterface::AccountTxMarker >, int > oldestAccountTxPage(soci::session &session, AccountIDCache const &idCache, std::function< void(std::uint32_t)> const &onUnsavedLedger, std::function< void(std::uint32_t, std::string const &, Blob &&, Blob &&)> const &onTransaction, RelationalDBInterface::AccountTxPageOptions const &options, int limit_used, std::uint32_t page_length)
oldestAccountTxPage Searches oldest transactions for given account which match given criteria startin...
Definition: RelationalDBInterface_nodes.cpp:1216
std::visit
T visit(T... args)
std::string::empty
T empty(T... args)
ripple::parseLedgerArgs
std::variant< std::optional< LedgerSpecifier >, grpc::Status > parseLedgerArgs(org::xrpl::rpc::v1::GetAccountTransactionHistoryRequest const &params)
Definition: AccountTx.cpp:56
std::optional
beast::Journal::debug
Stream debug() const
Definition: Journal.h:315
ripple::RelationalDBInterface::txnMetaLedgerType
std::tuple< Blob, Blob, std::uint32_t > txnMetaLedgerType
Definition: RelationalDBInterface.h:87
Json::Value::asInt
Int asInt() const
Definition: json_value.cpp:503
ripple::strHex
std::string strHex(FwdIt begin, FwdIt end)
Definition: strHex.h:45
ripple::rpcINVALID_LGR_RANGE
@ rpcINVALID_LGR_RANGE
Definition: ErrorCodes.h:136
ripple::RelationalDBInterface::AccountTxPageOptions
Definition: RelationalDBInterface.h:74
ripple::LedgerRange
Definition: RelationalDBInterface.h:42
ripple::base_uint::parseHex
constexpr bool parseHex(std::string_view sv)
Parse a hex string into a base_uint.
Definition: base_uint.h:472
ripple::RelationalDBInterface::AccountTxArgs::forward
bool forward
Definition: RelationalDBInterface.h:101
ripple::LedgerRange::min
uint32_t min
Definition: RelationalDBInterface.h:44
ripple::RPC::JsonContext::params
Json::Value params
Definition: Context.h:64
std::vector::data
T data(T... args)
ripple::RPC::Context
The context of information needed to call an RPC.
Definition: Context.h:39
ripple::TxnsDataBinary
RelationalDBInterface::MetaTxsList TxnsDataBinary
Definition: RelationalDBInterface_postgres.cpp:28
ripple::rpcNOT_SYNCED
@ rpcNOT_SYNCED
Definition: ErrorCodes.h:67
Json::Value
Represents a JSON value.
Definition: json_value.h:145
std::variant
ripple::RelationalDBInterface::AccountTxs
std::vector< AccountTx > AccountTxs
Definition: RelationalDBInterface.h:86
Json::Value::asString
std::string asString() const
Returns the unquoted string value.
Definition: json_value.cpp:469