rippled
ApplyStateTable.cpp
1 //------------------------------------------------------------------------------
2 /*
3  This file is part of rippled: https://github.com/ripple/rippled
4  Copyright (c) 2012, 2013 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/ledger/detail/ApplyStateTable.h>
21 #include <ripple/basics/Log.h>
22 #include <ripple/json/to_string.h>
23 #include <ripple/protocol/Feature.h>
24 #include <ripple/protocol/st.h>
25 #include <cassert>
26 
27 namespace ripple {
28 namespace detail {
29 
30 void
32 {
34  for (auto const& item : items_)
35  {
36  auto const& sle =
37  item.second.second;
38  switch(item.second.first)
39  {
40  case Action::cache:
41  break;
42  case Action::erase:
43  to.rawErase(sle);
44  break;
45  case Action::insert:
46  to.rawInsert(sle);
47  break;
48  case Action::modify:
49  to.rawReplace(sle);
50  break;
51  };
52  }
53 }
54 
57 {
58  std::size_t ret = 0;
59  for (auto& item : items_)
60  {
61  switch (item.second.first)
62  {
63  case Action::erase:
64  case Action::insert:
65  case Action::modify:
66  ++ret;
67  default:
68  break;
69  }
70  }
71  return ret;
72 }
73 
74 void
76  std::function <void (
77  uint256 const& key,
78  bool isDelete,
79  std::shared_ptr <SLE const> const& before,
80  std::shared_ptr <SLE const> const& after)> const& func) const
81 {
82  for (auto& item : items_)
83  {
84  switch (item.second.first)
85  {
86  case Action::erase:
87  func (item.first, true,
88  to.read (keylet::unchecked (item.first)), item.second.second);
89  break;
90 
91  case Action::insert:
92  func (item.first, false,
93  nullptr, item.second.second);
94  break;
95 
96  case Action::modify:
97  func (item.first, false,
98  to.read (keylet::unchecked (item.first)), item.second.second);
99  break;
100 
101  default:
102  break;
103  }
104  }
105 }
106 
107 void
109  STTx const& tx, TER ter,
110  boost::optional<STAmount> const& deliver,
111  beast::Journal j)
112 {
113  // Build metadata and insert
114  auto const sTx =
115  std::make_shared<Serializer>();
116  tx.add(*sTx);
118  if (!to.open())
119  {
120  TxMeta meta;
121  // VFALCO Shouldn't TxMeta ctor do this?
122  meta.init (tx.getTransactionID(), to.seq());
123  if (deliver)
124  meta.setDeliveredAmount(*deliver);
125  Mods newMod;
126  for (auto& item : items_)
127  {
128  SField const* type;
129  switch (item.second.first)
130  {
131  default:
132  case Action::cache:
133  continue;
134  case Action::erase:
135  type = &sfDeletedNode;
136  break;
137  case Action::insert:
138  type = &sfCreatedNode;
139  break;
140  case Action::modify:
141  type = &sfModifiedNode;
142  break;
143  }
144  auto const origNode =
145  to.read(keylet::unchecked(item.first));
146  auto curNode = item.second.second;
147  if ((type == &sfModifiedNode) && (*curNode == *origNode))
148  continue;
149  std::uint16_t nodeType = curNode
150  ? curNode->getFieldU16 (sfLedgerEntryType)
151  : origNode->getFieldU16 (sfLedgerEntryType);
152  meta.setAffectedNode (item.first, *type, nodeType);
153  if (type == &sfDeletedNode)
154  {
155  assert (origNode && curNode);
156  threadOwners (to, meta, origNode, newMod, j);
157 
158  STObject prevs (sfPreviousFields);
159  for (auto const& obj : *origNode)
160  {
161  // go through the original node for
162  // modified fields saved on modification
163  if (obj.getFName().shouldMeta(
165  ! curNode->hasMatchingEntry (obj))
166  prevs.emplace_back (obj);
167  }
168 
169  if (!prevs.empty ())
170  meta.getAffectedNode(item.first).emplace_back(std::move(prevs));
171 
172  STObject finals (sfFinalFields);
173  for (auto const& obj : *curNode)
174  {
175  // go through the final node for final fields
176  if (obj.getFName().shouldMeta(
178  finals.emplace_back (obj);
179  }
180 
181  if (!finals.empty ())
182  meta.getAffectedNode (item.first).emplace_back (std::move(finals));
183  }
184  else if (type == &sfModifiedNode)
185  {
186  assert (curNode && origNode);
187 
188  if (curNode->isThreadedType ()) // thread transaction to node item modified
189  threadItem (meta, curNode);
190 
191  STObject prevs (sfPreviousFields);
192  for (auto const& obj : *origNode)
193  {
194  // search the original node for values saved on modify
195  if (obj.getFName ().shouldMeta (SField::sMD_ChangeOrig) && !curNode->hasMatchingEntry (obj))
196  prevs.emplace_back (obj);
197  }
198 
199  if (!prevs.empty ())
200  meta.getAffectedNode (item.first).emplace_back (std::move(prevs));
201 
202  STObject finals (sfFinalFields);
203  for (auto const& obj : *curNode)
204  {
205  // search the final node for values saved always
206  if (obj.getFName ().shouldMeta (SField::sMD_Always | SField::sMD_ChangeNew))
207  finals.emplace_back (obj);
208  }
209 
210  if (!finals.empty ())
211  meta.getAffectedNode (item.first).emplace_back (std::move(finals));
212  }
213  else if (type == &sfCreatedNode) // if created, thread to owner(s)
214  {
215  assert (curNode && !origNode);
216  threadOwners (to, meta, curNode, newMod, j);
217 
218  if (curNode->isThreadedType ()) // always thread to self
219  threadItem (meta, curNode);
220 
221  STObject news (sfNewFields);
222  for (auto const& obj : *curNode)
223  {
224  // save non-default values
225  if (!obj.isDefault () &&
226  obj.getFName().shouldMeta(
228  news.emplace_back (obj);
229  }
230 
231  if (!news.empty ())
232  meta.getAffectedNode (item.first).emplace_back (std::move(news));
233  }
234  else
235  {
236  assert (false);
237  }
238  }
239 
240  // add any new modified nodes to the modification set
241  for (auto& mod : newMod)
242  to.rawReplace (mod.second);
243 
244  sMeta = std::make_shared<Serializer>();
245  meta.addRaw (*sMeta, ter, to.txCount());
246 
247  // VFALCO For diagnostics do we want to show
248  // metadata even when the base view is open?
249  JLOG(j.trace()) <<
250  "metadata " << meta.getJson (JsonOptions::none);
251  }
252  to.rawTxInsert(
253  tx.getTransactionID(),
254  sTx, sMeta);
255  apply(to);
256 }
257 
258 //---
259 
260 bool
262  Keylet const& k) const
263 {
264  auto const iter = items_.find(k.key);
265  if (iter == items_.end())
266  return base.exists(k);
267  auto const& item = iter->second;
268  auto const& sle = item.second;
269  switch (item.first)
270  {
271  case Action::erase:
272  return false;
273  case Action::cache:
274  case Action::insert:
275  case Action::modify:
276  break;
277  }
278  if (! k.check(*sle))
279  return false;
280  return true;
281 }
282 
283 auto
285  key_type const& key, boost::optional<
286  key_type> const& last) const ->
287  boost::optional<key_type>
288 {
289  boost::optional<key_type> next = key;
290  items_t::const_iterator iter;
291  // Find base successor that is
292  // not also deleted in our list
293  do
294  {
295  next = base.succ(*next, last);
296  if (! next)
297  break;
298  iter = items_.find(*next);
299  }
300  while (iter != items_.end() &&
301  iter->second.first == Action::erase);
302  // Find non-deleted successor in our list
303  for (iter = items_.upper_bound(key);
304  iter != items_.end (); ++iter)
305  {
306  if (iter->second.first != Action::erase)
307  {
308  // Found both, return the lower key
309  if (! next || next > iter->first)
310  next = iter->first;
311  break;
312  }
313  }
314  // Nothing in our list, return
315  // what we got from the parent.
316  if (last && next >= last)
317  return boost::none;
318  return next;
319 }
320 
323  Keylet const& k) const
324 {
325  auto const iter = items_.find(k.key);
326  if (iter == items_.end())
327  return base.read(k);
328  auto const& item = iter->second;
329  auto const& sle = item.second;
330  switch (item.first)
331  {
332  case Action::erase:
333  return nullptr;
334  case Action::cache:
335  case Action::insert:
336  case Action::modify:
337  break;
338  };
339  if (! k.check(*sle))
340  return nullptr;
341  return sle;
342 }
343 
346  Keylet const& k)
347 {
348  auto iter = items_.lower_bound(k.key);
349  if (iter == items_.end() ||
350  iter->first != k.key)
351  {
352  auto const sle = base.read(k);
353  if (! sle)
354  return nullptr;
355  // Make our own copy
356  using namespace std;
357  iter = items_.emplace_hint (iter,
358  piecewise_construct,
359  forward_as_tuple(sle->key()),
361  make_shared<SLE>(*sle)));
362  return iter->second.second;
363  }
364  auto const& item = iter->second;
365  auto const& sle = item.second;
366  switch (item.first)
367  {
368  case Action::erase:
369  return nullptr;
370  case Action::cache:
371  case Action::insert:
372  case Action::modify:
373  break;
374  };
375  if (! k.check(*sle))
376  return nullptr;
377  return sle;
378 }
379 
380 void
382  ReadView const& base,
383  std::shared_ptr<SLE> const& sle)
384 {
385  auto const iter =
386  items_.find(sle->key());
387  if (iter == items_.end())
388  LogicError("ApplyStateTable::erase: missing key");
389  auto& item = iter->second;
390  if (item.second != sle)
391  LogicError("ApplyStateTable::erase: unknown SLE");
392  switch(item.first)
393  {
394  case Action::erase:
395  LogicError("ApplyStateTable::erase: double erase");
396  break;
397  case Action::insert:
398  items_.erase(iter);
399  break;
400  case Action::cache:
401  case Action::modify:
402  item.first = Action::erase;
403  break;
404  }
405 }
406 
407 void
409  std::shared_ptr<SLE> const& sle)
410 {
411  using namespace std;
412  auto const result = items_.emplace(
413  piecewise_construct,
414  forward_as_tuple(sle->key()),
416  if (result.second)
417  return;
418  auto& item = result.first->second;
419  switch(item.first)
420  {
421  case Action::erase:
422  LogicError("ApplyStateTable::rawErase: double erase");
423  break;
424  case Action::insert:
425  items_.erase(result.first);
426  break;
427  case Action::cache:
428  case Action::modify:
429  item.first = Action::erase;
430  item.second = sle;
431  break;
432  }
433 }
434 
435 void
437  std::shared_ptr<SLE> const& sle)
438 {
439  auto const iter =
440  items_.lower_bound(sle->key());
441  if (iter == items_.end() ||
442  iter->first != sle->key())
443  {
444  using namespace std;
445  items_.emplace_hint(iter,
446  piecewise_construct,
447  forward_as_tuple(sle->key()),
449  return;
450  }
451  auto& item = iter->second;
452  switch(item.first)
453  {
454  case Action::cache:
455  LogicError("ApplyStateTable::insert: already cached");
456  case Action::insert:
457  LogicError("ApplyStateTable::insert: already inserted");
458  case Action::modify:
459  LogicError("ApplyStateTable::insert: already modified");
460  case Action::erase:
461  break;
462  }
463  item.first = Action::modify;
464  item.second = sle;
465 }
466 
467 void
469  std::shared_ptr<SLE> const& sle)
470 {
471  auto const iter =
472  items_.lower_bound(sle->key());
473  if (iter == items_.end() ||
474  iter->first != sle->key())
475  {
476  using namespace std;
477  items_.emplace_hint(iter, piecewise_construct,
478  forward_as_tuple(sle->key()),
480  return;
481  }
482  auto& item = iter->second;
483  switch (item.first)
484  {
485  case Action::erase:
486  LogicError("ApplyStateTable::replace: already erased");
487  case Action::cache:
488  item.first = Action::modify;
489  break;
490  case Action::insert:
491  case Action::modify:
492  break;
493  }
494  item.second = sle;
495 }
496 
497 void
499  std::shared_ptr<SLE> const& sle)
500 {
501  auto const iter =
502  items_.find(sle->key());
503  if (iter == items_.end())
504  LogicError("ApplyStateTable::update: missing key");
505  auto& item = iter->second;
506  if (item.second != sle)
507  LogicError("ApplyStateTable::update: unknown SLE");
508  switch (item.first)
509  {
510  case Action::erase:
511  LogicError("ApplyStateTable::update: erased");
512  break;
513  case Action::cache:
514  item.first = Action::modify;
515  break;
516  case Action::insert:
517  case Action::modify:
518  break;
519  };
520 }
521 
522 void
524 {
525  dropsDestroyed_ += fee;
526 }
527 
528 //------------------------------------------------------------------------------
529 
530 // Insert this transaction to the SLE's threading list
531 void
533  std::shared_ptr<SLE> const& sle)
534 {
535  key_type prevTxID;
536  LedgerIndex prevLgrID;
537  if (! sle->thread(meta.getTxID(),
538  meta.getLgrSeq(), prevTxID, prevLgrID))
539  return;
540  if (prevTxID.isZero())
541  return;
543  sle, sfModifiedNode), prevTxID, prevLgrID);
544 }
545 
548  key_type const& key, Mods& mods, beast::Journal j)
549 {
550  {
551  auto miter = mods.find (key);
552  if (miter != mods.end ())
553  {
554  assert (miter->second);
555  return miter->second;
556  }
557  }
558  {
559  auto iter = items_.find (key);
560  if (iter != items_.end ())
561  {
562  auto const& item = iter->second;
563  if (item.first == Action::erase)
564  {
565  // The Destination of an Escrow or a PayChannel may have been
566  // deleted. In that case the account we're threading to will
567  // not be found and it is appropriate to return a nullptr.
568  JLOG(j.warn()) << "Trying to thread to deleted node";
569  return nullptr;
570  }
571  if (item.first != Action::cache)
572  return item.second;
573 
574  // If it's only cached, then the node is being modified only by
575  // metadata; fall through and track it in the mods table.
576  }
577  }
578  auto c = base.read (keylet::unchecked (key));
579  if (! c)
580  {
581  // The Destination of an Escrow or a PayChannel may have been
582  // deleted. In that case the account we're threading to will
583  // not be found and it is appropriate to return a nullptr.
584  JLOG(j.warn()) << "ApplyStateTable::getForMod: key not found";
585  return nullptr;
586  }
587  auto sle = std::make_shared<SLE> (*c);
588  mods.emplace(key, sle);
589  return sle;
590 }
591 
592 void
594  TxMeta& meta, AccountID const& to,
595  Mods& mods, beast::Journal j)
596 {
597  auto const sle = getForMod(base,
598  keylet::account(to).key, mods, j);
599  if (! sle)
600  {
601  // The Destination of an Escrow or PayChannel may have been deleted.
602  // In that case the account we are threading to will not be found.
603  // So this logging is just a warning.
604  JLOG(j.warn()) << "Threading to non-existent account: " << toBase58(to);
605  return;
606  }
607  threadItem (meta, sle);
608 }
609 
610 void
612  TxMeta& meta, std::shared_ptr<
613  SLE const> const& sle, Mods& mods,
614  beast::Journal j)
615 {
616  LedgerEntryType const ledgerType {sle->getType()};
617  switch(ledgerType)
618  {
619  case ltACCOUNT_ROOT:
620  {
621  // Nothing to do
622  break;
623  }
624  case ltRIPPLE_STATE:
625  {
626  threadTx (base, meta, (*sle)[sfLowLimit].getIssuer(), mods, j);
627  threadTx (base, meta, (*sle)[sfHighLimit].getIssuer(), mods, j);
628  break;
629  }
630  default:
631  {
632  // If sfAccount is present, thread to that account
633  if (auto const optSleAcct {(*sle)[~sfAccount]})
634  threadTx (base, meta, *optSleAcct, mods, j);
635 
636  // Don't thread a check's sfDestination unless the amendment is enabled
637  if (ledgerType == ltCHECK && !base.rules().enabled(fixCheckThreading))
638  break;
639 
640  // If sfDestination is present, thread to that account
641  if (auto const optSleDest {(*sle)[~sfDestination]})
642  threadTx (base, meta, *optSleDest, mods, j);
643  }
644  }
645 }
646 
647 } // detail
648 } // ripple
ripple::OpenView::txCount
std::size_t txCount() const
Return the number of tx inserted since creation.
Definition: OpenView.cpp:114
ripple::detail::ApplyStateTable::size
std::size_t size() const
Definition: ApplyStateTable.cpp:56
ripple::Keylet
A pair of SHAMap key and LedgerEntryType.
Definition: Keylet.h:38
ripple::sfPreviousFields
const SField sfPreviousFields(access, STI_OBJECT, 6, "PreviousFields")
Definition: SField.h:483
ripple::STLedgerEntry
Definition: STLedgerEntry.h:30
std::shared_ptr
STL class.
beast::Journal::trace
Stream trace() const
Severity stream access functions.
Definition: Journal.h:287
ripple::sfLedgerEntryType
const SF_U16 sfLedgerEntryType(access, STI_UINT16, 1, "LedgerEntryType", SField::sMD_Never)
Definition: SField.h:330
ripple::detail::ApplyStateTable::insert
void insert(ReadView const &base, std::shared_ptr< SLE > const &sle)
Definition: ApplyStateTable.cpp:436
ripple::OpenView
Writable ledger view that accumulates state and tx changes.
Definition: OpenView.h:52
std::map::find
T find(T... args)
ripple::detail::ApplyStateTable::visit
void visit(ReadView const &base, std::function< void(uint256 const &key, bool isDelete, std::shared_ptr< SLE const > const &before, std::shared_ptr< SLE const > const &after)> const &func) const
Definition: ApplyStateTable.cpp:75
ripple::RawView::rawDestroyXRP
virtual void rawDestroyXRP(XRPAmount const &fee)=0
Destroy XRP.
ripple::sfAccount
const SF_Account sfAccount(access, STI_ACCOUNT, 1, "Account")
Definition: SField.h:460
ripple::sfNewFields
const SField sfNewFields(access, STI_OBJECT, 8, "NewFields")
Definition: SField.h:485
ripple::SField::sMD_ChangeNew
@ sMD_ChangeNew
Definition: SField.h:119
ripple::toBase58
std::string toBase58(AccountID const &v)
Convert AccountID to base58 checked string.
Definition: AccountID.cpp:29
ripple::STObject::empty
bool empty() const
Definition: STObject.h:311
std::map::emplace
T emplace(T... args)
beast::Journal::warn
Stream warn() const
Definition: Journal.h:302
ripple::detail::ApplyStateTable::exists
bool exists(ReadView const &base, Keylet const &k) const
Definition: ApplyStateTable.cpp:261
std::function
ripple::TxMeta::getTxID
uint256 const & getTxID()
Definition: TxMeta.h:73
ripple::detail::ApplyStateTable::threadItem
static void threadItem(TxMeta &meta, std::shared_ptr< SLE > const &to)
Definition: ApplyStateTable.cpp:532
ripple::detail::ApplyStateTable::Action::cache
@ cache
ripple::RawView::rawReplace
virtual void rawReplace(std::shared_ptr< SLE > const &sle)=0
Unconditionally replace a state item.
ripple::sfFinalFields
const SField sfFinalFields(access, STI_OBJECT, 7, "FinalFields")
Definition: SField.h:484
ripple::sfModifiedNode
const SField sfModifiedNode(access, STI_OBJECT, 5, "ModifiedNode")
Definition: SField.h:482
ripple::sfHighLimit
const SF_Amount sfHighLimit(access, STI_AMOUNT, 7, "HighLimit")
Definition: SField.h:429
ripple::detail::ApplyStateTable::destroyXRP
void destroyXRP(XRPAmount const &fee)
Definition: ApplyStateTable.cpp:523
ripple::sfLowLimit
const SF_Amount sfLowLimit(access, STI_AMOUNT, 6, "LowLimit")
Definition: SField.h:428
ripple::ltCHECK
@ ltCHECK
Definition: LedgerFormats.h:86
ripple::detail::ApplyStateTable::dropsDestroyed_
XRPAmount dropsDestroyed_
Definition: ApplyStateTable.h:54
ripple::detail::ApplyStateTable::replace
void replace(ReadView const &base, std::shared_ptr< SLE > const &sle)
Definition: ApplyStateTable.cpp:468
ripple::RawView::rawErase
virtual void rawErase(std::shared_ptr< SLE > const &sle)=0
Delete an existing state item.
ripple::TxMeta
Definition: TxMeta.h:33
ripple::Keylet::key
uint256 key
Definition: Keylet.h:41
ripple::base_uint< 256 >
ripple::RawView
Interface for ledger entry changes.
Definition: RawView.h:37
std::map::emplace_hint
T emplace_hint(T... args)
ripple::SField::sMD_Always
@ sMD_Always
Definition: SField.h:122
ripple::base_uint::isZero
bool isZero() const
Definition: base_uint.h:429
ripple::detail::ApplyStateTable::apply
void apply(RawView &to) const
Definition: ApplyStateTable.cpp:31
ripple::SField::sMD_Create
@ sMD_Create
Definition: SField.h:121
ripple::detail::ApplyStateTable::threadOwners
void threadOwners(ReadView const &base, TxMeta &meta, std::shared_ptr< SLE const > const &sle, Mods &mods, beast::Journal j)
Definition: ApplyStateTable.cpp:611
ripple::RawView::rawInsert
virtual void rawInsert(std::shared_ptr< SLE > const &sle)=0
Unconditionally insert a state item.
ripple::keylet::account
static const account_t account
Definition: Indexes.h:116
ripple::fixCheckThreading
const uint256 fixCheckThreading
Definition: Feature.cpp:175
ripple::OpenView::rawReplace
void rawReplace(std::shared_ptr< SLE > const &sle) override
Unconditionally replace a state item.
Definition: OpenView.cpp:249
ripple::JsonOptions::none
@ none
ripple::TERSubset< CanCvtToTER >
ripple::TxMeta::addRaw
void addRaw(Serializer &, TER, std::uint32_t index)
Definition: TxMeta.cpp:254
ripple::OpenView::open
bool open() const override
Returns true if this reflects an open ledger.
Definition: OpenView.h:144
ripple::TxMeta::init
void init(uint256 const &transactionID, std::uint32_t ledger)
Definition: TxMeta.cpp:208
ripple::ReadView::exists
virtual bool exists(Keylet const &k) const =0
Determine if a state item exists.
std::map::erase
T erase(T... args)
ripple::SField::sMD_DeleteFinal
@ sMD_DeleteFinal
Definition: SField.h:120
ripple::detail::ApplyStateTable::erase
void erase(ReadView const &base, std::shared_ptr< SLE > const &sle)
Definition: ApplyStateTable.cpp:381
ripple::detail::ApplyStateTable::Action::erase
@ erase
ripple::STTx
Definition: STTx.h:43
ripple::detail::ApplyStateTable::threadTx
void threadTx(ReadView const &base, TxMeta &meta, AccountID const &to, Mods &mods, beast::Journal j)
Definition: ApplyStateTable.cpp:593
beast::Journal
A generic endpoint for log messages.
Definition: Journal.h:60
std::uint16_t
ripple::Rules::enabled
bool enabled(uint256 const &id) const
Returns true if a feature is enabled.
Definition: ReadView.cpp:107
std::forward_as_tuple
T forward_as_tuple(T... args)
ripple::sfCreatedNode
const SField sfCreatedNode(access, STI_OBJECT, 3, "CreatedNode")
Definition: SField.h:480
ripple::TxMeta::getJson
Json::Value getJson(JsonOptions p) const
Definition: TxMeta.h:105
ripple::detail::ApplyStateTable::read
std::shared_ptr< SLE const > read(ReadView const &base, Keylet const &k) const
Definition: ApplyStateTable.cpp:322
ripple::ReadView::read
virtual std::shared_ptr< SLE const > read(Keylet const &k) const =0
Return the state item associated with a key.
ripple::keylet::unchecked
Keylet unchecked(uint256 const &key)
Any ledger entry.
Definition: Indexes.cpp:313
ripple::detail::ApplyStateTable::rawErase
void rawErase(ReadView const &base, std::shared_ptr< SLE > const &sle)
Definition: ApplyStateTable.cpp:408
ripple::TxMeta::thread
static bool thread(STObject &node, uint256 const &prevTxID, std::uint32_t prevLgrID)
Definition: TxMeta.cpp:222
ripple::STTx::getTransactionID
uint256 getTransactionID() const
Definition: STTx.h:120
ripple::detail::ApplyStateTable::getForMod
std::shared_ptr< SLE > getForMod(ReadView const &base, key_type const &key, Mods &mods, beast::Journal j)
Definition: ApplyStateTable.cpp:547
ripple::STObject::emplace_back
std::size_t emplace_back(Args &&... args)
Definition: STObject.h:371
ripple::SField::sMD_ChangeOrig
@ sMD_ChangeOrig
Definition: SField.h:118
ripple::detail::ApplyStateTable::succ
boost::optional< key_type > succ(ReadView const &base, key_type const &key, boost::optional< key_type > const &last) const
Definition: ApplyStateTable.cpp:284
ripple::STObject
Definition: STObject.h:51
ripple::ReadView
A view into a ledger.
Definition: ReadView.h:186
ripple
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
Definition: RCLCensorshipDetector.h:29
ripple::ltRIPPLE_STATE
@ ltRIPPLE_STATE
Definition: LedgerFormats.h:67
std::map::lower_bound
T lower_bound(T... args)
ripple::STObject::add
virtual void add(Serializer &s) const override
Definition: STObject.h:343
ripple::OpenView::rawTxInsert
void rawTxInsert(key_type const &key, std::shared_ptr< Serializer const > const &txn, std::shared_ptr< Serializer const > const &metaData) override
Add a transaction to the tx map.
Definition: OpenView.cpp:267
ripple::TxMeta::getAffectedNode
STObject & getAffectedNode(SLE::ref node, SField const &type)
Definition: TxMeta.cpp:166
ripple::SField
Identifies fields.
Definition: SField.h:112
ripple::LedgerEntryType
LedgerEntryType
Ledger entry types.
Definition: LedgerFormats.h:36
ripple::ReadView::seq
LedgerIndex seq() const
Returns the sequence number of the base ledger.
Definition: ReadView.h:258
ripple::ReadView::rules
virtual Rules const & rules() const =0
Returns the tx processing rules.
std
STL namespace.
ripple::LogicError
void LogicError(std::string const &how) noexcept
Called when faulty logic causes a broken invariant.
Definition: contract.cpp:50
cassert
ripple::TxMeta::setDeliveredAmount
void setDeliveredAmount(STAmount const &delivered)
Definition: TxMeta.h:117
ripple::detail::ApplyStateTable::update
void update(ReadView const &base, std::shared_ptr< SLE > const &sle)
Definition: ApplyStateTable.cpp:498
ripple::OpenView::read
std::shared_ptr< SLE const > read(Keylet const &k) const override
Return the state item associated with a key.
Definition: OpenView.cpp:164
ripple::sfDestination
const SF_Account sfDestination(access, STI_ACCOUNT, 3, "Destination")
Definition: SField.h:462
ripple::after
static bool after(NetClock::time_point now, std::uint32_t mark)
Has the specified time passed?
Definition: Escrow.cpp:87
std::size_t
ripple::TxMeta::getLgrSeq
std::uint32_t getLgrSeq()
Definition: TxMeta.h:77
ripple::Keylet::check
bool check(STLedgerEntry const &) const
Returns true if the SLE matches the type.
Definition: Keylet.cpp:26
std::map::end
T end(T... args)
ripple::detail::ApplyStateTable::Action::modify
@ modify
ripple::sfDeletedNode
const SField sfDeletedNode(access, STI_OBJECT, 4, "DeletedNode")
Definition: SField.h:481
ripple::detail::ApplyStateTable::peek
std::shared_ptr< SLE > peek(ReadView const &base, Keylet const &k)
Definition: ApplyStateTable.cpp:345
ripple::detail::ApplyStateTable::items_
items_t items_
Definition: ApplyStateTable.h:53
ripple::ltACCOUNT_ROOT
@ ltACCOUNT_ROOT
Definition: LedgerFormats.h:54
std::unordered_map
STL class.
ripple::detail::ApplyStateTable::Action::insert
@ insert
ripple::TxMeta::setAffectedNode
void setAffectedNode(uint256 const &, SField const &type, std::uint16_t nodeType)
Definition: TxMeta.cpp:92
ripple::XRPAmount
Definition: XRPAmount.h:46