rippled
PayChan.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/app/tx/impl/PayChan.h>
21 #include <ripple/basics/Log.h>
22 #include <ripple/basics/XRPAmount.h>
23 #include <ripple/basics/chrono.h>
24 #include <ripple/ledger/ApplyView.h>
25 #include <ripple/ledger/View.h>
26 #include <ripple/protocol/Feature.h>
27 #include <ripple/protocol/Indexes.h>
28 #include <ripple/protocol/PayChan.h>
29 #include <ripple/protocol/PublicKey.h>
30 #include <ripple/protocol/TxFlags.h>
31 #include <ripple/protocol/digest.h>
32 #include <ripple/protocol/st.h>
33 
34 namespace ripple {
35 
36 /*
37  PaymentChannel
38 
39  Payment channels permit off-ledger checkpoints of XRP payments flowing
40  in a single direction. A channel sequesters the owner's XRP in its own
41  ledger entry. The owner can authorize the recipient to claim up to a
42  given balance by giving the receiver a signed message (off-ledger). The
43  recipient can use this signed message to claim any unpaid balance while
44  the channel remains open. The owner can top off the line as needed. If
45  the channel has not paid out all its funds, the owner must wait out a
46  delay to close the channel to give the recipient a chance to supply any
47  claims. The recipient can close the channel at any time. Any transaction
48  that touches the channel after the expiration time will close the
49  channel. The total amount paid increases monotonically as newer claims
50  are issued. When the channel is closed any remaining balance is returned
51  to the owner. Channels are intended to permit intermittent off-ledger
52  settlement of ILP trust lines as balances get substantial. For
53  bidirectional channels, a payment channel can be used in each direction.
54 
55  PaymentChannelCreate
56 
57  Create a unidirectional channel. The parameters are:
58  Destination
59  The recipient at the end of the channel.
60  Amount
61  The amount of XRP to deposit in the channel immediately.
62  SettleDelay
63  The amount of time everyone but the recipient must wait for a
64  superior claim.
65  PublicKey
66  The key that will sign claims against the channel.
67  CancelAfter (optional)
68  Any channel transaction that touches this channel after the
69  `CancelAfter` time will close it.
70  DestinationTag (optional)
71  Destination tags allow the different accounts inside of a Hosted
72  Wallet to be mapped back onto the Ripple ledger. The destination tag
73  tells the server to which account in the Hosted Wallet the funds are
74  intended to go to. Required if the destination has lsfRequireDestTag
75  set.
76  SourceTag (optional)
77  Source tags allow the different accounts inside of a Hosted Wallet
78  to be mapped back onto the Ripple ledger. Source tags are similar to
79  destination tags but are for the channel owner to identify their own
80  transactions.
81 
82  PaymentChannelFund
83 
84  Add additional funds to the payment channel. Only the channel owner may
85  use this transaction. The parameters are:
86  Channel
87  The 256-bit ID of the channel.
88  Amount
89  The amount of XRP to add.
90  Expiration (optional)
91  Time the channel closes. The transaction will fail if the expiration
92  times does not satisfy the SettleDelay constraints.
93 
94  PaymentChannelClaim
95 
96  Place a claim against an existing channel. The parameters are:
97  Channel
98  The 256-bit ID of the channel.
99  Balance (optional)
100  The total amount of XRP delivered after this claim is processed
101  (optional, not needed if just closing). Amount (optional) The amount of XRP
102  the signature is for (not needed if equal to Balance or just closing the
103  line). Signature (optional) Authorization for the balance above, signed by
104  the owner (optional, not needed if closing or owner is performing the
105  transaction). The signature if for the following message: CLM\0 followed by
106  the 256-bit channel ID, and a 64-bit integer drops. PublicKey (optional) The
107  public key that made the signature (optional, required if a signature is
108  present) Flags tfClose Request that the channel be closed tfRenew Request
109  that the channel's expiration be reset. Only the owner may renew a channel.
110 
111 */
112 
113 //------------------------------------------------------------------------------
114 
115 static TER
117  std::shared_ptr<SLE> const& slep,
118  ApplyView& view,
119  uint256 const& key,
120  beast::Journal j)
121 {
122  AccountID const src = (*slep)[sfAccount];
123  // Remove PayChan from owner directory
124  {
125  auto const page = (*slep)[sfOwnerNode];
126  if (!view.dirRemove(keylet::ownerDir(src), page, key, true))
127  {
128  JLOG(j.fatal())
129  << "Could not remove paychan from src owner directory";
130  return tefBAD_LEDGER;
131  }
132  }
133 
134  // Remove PayChan from recipient's owner directory, if present.
135  if (auto const page = (*slep)[~sfDestinationNode];
136  page && view.rules().enabled(fixPayChanRecipientOwnerDir))
137  {
138  auto const dst = (*slep)[sfDestination];
139  if (!view.dirRemove(keylet::ownerDir(dst), *page, key, true))
140  {
141  JLOG(j.fatal())
142  << "Could not remove paychan from dst owner directory";
143  return tefBAD_LEDGER;
144  }
145  }
146 
147  // Transfer amount back to owner, decrement owner count
148  auto const sle = view.peek(keylet::account(src));
149  if (!sle)
150  return tefINTERNAL;
151 
152  assert((*slep)[sfAmount] >= (*slep)[sfBalance]);
153  (*sle)[sfBalance] =
154  (*sle)[sfBalance] + (*slep)[sfAmount] - (*slep)[sfBalance];
155  adjustOwnerCount(view, sle, -1, j);
156  view.update(sle);
157 
158  // Remove PayChan from ledger
159  view.erase(slep);
160  return tesSUCCESS;
161 }
162 
163 //------------------------------------------------------------------------------
164 
165 TxConsequences
167 {
168  return TxConsequences{ctx.tx, ctx.tx[sfAmount].xrp()};
169 }
170 
171 NotTEC
173 {
174  if (ctx.rules.enabled(fix1543) && ctx.tx.getFlags() & tfUniversalMask)
175  return temINVALID_FLAG;
176 
177  if (auto const ret = preflight1(ctx); !isTesSuccess(ret))
178  return ret;
179 
180  if (!isXRP(ctx.tx[sfAmount]) || (ctx.tx[sfAmount] <= beast::zero))
181  return temBAD_AMOUNT;
182 
183  if (ctx.tx[sfAccount] == ctx.tx[sfDestination])
184  return temDST_IS_SRC;
185 
186  if (!publicKeyType(ctx.tx[sfPublicKey]))
187  return temMALFORMED;
188 
189  return preflight2(ctx);
190 }
191 
192 TER
194 {
195  auto const account = ctx.tx[sfAccount];
196  auto const sle = ctx.view.read(keylet::account(account));
197  if (!sle)
198  return terNO_ACCOUNT;
199 
200  // Check reserve and funds availability
201  {
202  auto const balance = (*sle)[sfBalance];
203  auto const reserve =
204  ctx.view.fees().accountReserve((*sle)[sfOwnerCount] + 1);
205 
206  if (balance < reserve)
208 
209  if (balance < reserve + ctx.tx[sfAmount])
210  return tecUNFUNDED;
211  }
212 
213  auto const dst = ctx.tx[sfDestination];
214 
215  {
216  // Check destination account
217  auto const sled = ctx.view.read(keylet::account(dst));
218  if (!sled)
219  return tecNO_DST;
220 
221  auto const flags = sled->getFlags();
222 
223  // Check if they have disallowed incoming payment channels
225  (flags & lsfDisallowIncomingPayChan))
226  return tecNO_PERMISSION;
227 
228  if ((flags & lsfRequireDestTag) && !ctx.tx[~sfDestinationTag])
229  return tecDST_TAG_NEEDED;
230 
231  // Obeying the lsfDisallowXRP flag was a bug. Piggyback on
232  // featureDepositAuth to remove the bug.
233  if (!ctx.view.rules().enabled(featureDepositAuth) &&
234  (flags & lsfDisallowXRP))
235  return tecNO_TARGET;
236 
237  if (sled->isFieldPresent(sfAMMID))
238  return tecNO_PERMISSION;
239  }
240 
241  return tesSUCCESS;
242 }
243 
244 TER
246 {
247  auto const account = ctx_.tx[sfAccount];
248  auto const sle = ctx_.view().peek(keylet::account(account));
249  if (!sle)
250  return tefINTERNAL;
251 
252  auto const dst = ctx_.tx[sfDestination];
253 
254  // Create PayChan in ledger.
255  //
256  // Note that we we use the value from the sequence or ticket as the
257  // payChan sequence. For more explanation see comments in SeqProxy.h.
258  Keylet const payChanKeylet =
259  keylet::payChan(account, dst, ctx_.tx.getSeqProxy().value());
260  auto const slep = std::make_shared<SLE>(payChanKeylet);
261 
262  // Funds held in this channel
263  (*slep)[sfAmount] = ctx_.tx[sfAmount];
264  // Amount channel has already paid
265  (*slep)[sfBalance] = ctx_.tx[sfAmount].zeroed();
266  (*slep)[sfAccount] = account;
267  (*slep)[sfDestination] = dst;
268  (*slep)[sfSettleDelay] = ctx_.tx[sfSettleDelay];
269  (*slep)[sfPublicKey] = ctx_.tx[sfPublicKey];
270  (*slep)[~sfCancelAfter] = ctx_.tx[~sfCancelAfter];
271  (*slep)[~sfSourceTag] = ctx_.tx[~sfSourceTag];
273 
274  ctx_.view().insert(slep);
275 
276  // Add PayChan to owner directory
277  {
278  auto const page = ctx_.view().dirInsert(
279  keylet::ownerDir(account),
280  payChanKeylet,
281  describeOwnerDir(account));
282  if (!page)
283  return tecDIR_FULL;
284  (*slep)[sfOwnerNode] = *page;
285  }
286 
287  // Add PayChan to the recipient's owner directory
289  {
290  auto const page = ctx_.view().dirInsert(
291  keylet::ownerDir(dst), payChanKeylet, describeOwnerDir(dst));
292  if (!page)
293  return tecDIR_FULL;
294  (*slep)[sfDestinationNode] = *page;
295  }
296 
297  // Deduct owner's balance, increment owner count
298  (*sle)[sfBalance] = (*sle)[sfBalance] - ctx_.tx[sfAmount];
299  adjustOwnerCount(ctx_.view(), sle, 1, ctx_.journal);
300  ctx_.view().update(sle);
301 
302  return tesSUCCESS;
303 }
304 
305 //------------------------------------------------------------------------------
306 
309 {
310  return TxConsequences{ctx.tx, ctx.tx[sfAmount].xrp()};
311 }
312 
313 NotTEC
315 {
316  if (ctx.rules.enabled(fix1543) && ctx.tx.getFlags() & tfUniversalMask)
317  return temINVALID_FLAG;
318 
319  if (auto const ret = preflight1(ctx); !isTesSuccess(ret))
320  return ret;
321 
322  if (!isXRP(ctx.tx[sfAmount]) || (ctx.tx[sfAmount] <= beast::zero))
323  return temBAD_AMOUNT;
324 
325  return preflight2(ctx);
326 }
327 
328 TER
330 {
331  Keylet const k(ltPAYCHAN, ctx_.tx[sfChannel]);
332  auto const slep = ctx_.view().peek(k);
333  if (!slep)
334  return tecNO_ENTRY;
335 
336  AccountID const src = (*slep)[sfAccount];
337  auto const txAccount = ctx_.tx[sfAccount];
338  auto const expiration = (*slep)[~sfExpiration];
339 
340  {
341  auto const cancelAfter = (*slep)[~sfCancelAfter];
342  auto const closeTime =
344  if ((cancelAfter && closeTime >= *cancelAfter) ||
345  (expiration && closeTime >= *expiration))
346  return closeChannel(
347  slep, ctx_.view(), k.key, ctx_.app.journal("View"));
348  }
349 
350  if (src != txAccount)
351  // only the owner can add funds or extend
352  return tecNO_PERMISSION;
353 
354  if (auto extend = ctx_.tx[~sfExpiration])
355  {
356  auto minExpiration =
358  (*slep)[sfSettleDelay];
359  if (expiration && *expiration < minExpiration)
360  minExpiration = *expiration;
361 
362  if (*extend < minExpiration)
363  return temBAD_EXPIRATION;
364  (*slep)[~sfExpiration] = *extend;
365  ctx_.view().update(slep);
366  }
367 
368  auto const sle = ctx_.view().peek(keylet::account(txAccount));
369  if (!sle)
370  return tefINTERNAL;
371 
372  {
373  // Check reserve and funds availability
374  auto const balance = (*sle)[sfBalance];
375  auto const reserve =
377 
378  if (balance < reserve)
380 
381  if (balance < reserve + ctx_.tx[sfAmount])
382  return tecUNFUNDED;
383  }
384 
385  // do not allow adding funds if dst does not exist
386  if (AccountID const dst = (*slep)[sfDestination];
387  !ctx_.view().read(keylet::account(dst)))
388  {
389  return tecNO_DST;
390  }
391 
392  (*slep)[sfAmount] = (*slep)[sfAmount] + ctx_.tx[sfAmount];
393  ctx_.view().update(slep);
394 
395  (*sle)[sfBalance] = (*sle)[sfBalance] - ctx_.tx[sfAmount];
396  ctx_.view().update(sle);
397 
398  return tesSUCCESS;
399 }
400 
401 //------------------------------------------------------------------------------
402 
403 NotTEC
405 {
406  if (auto const ret = preflight1(ctx); !isTesSuccess(ret))
407  return ret;
408 
409  auto const bal = ctx.tx[~sfBalance];
410  if (bal && (!isXRP(*bal) || *bal <= beast::zero))
411  return temBAD_AMOUNT;
412 
413  auto const amt = ctx.tx[~sfAmount];
414  if (amt && (!isXRP(*amt) || *amt <= beast::zero))
415  return temBAD_AMOUNT;
416 
417  if (bal && amt && *bal > *amt)
418  return temBAD_AMOUNT;
419 
420  {
421  auto const flags = ctx.tx.getFlags();
422 
423  if (ctx.rules.enabled(fix1543) && (flags & tfPayChanClaimMask))
424  return temINVALID_FLAG;
425 
426  if ((flags & tfClose) && (flags & tfRenew))
427  return temMALFORMED;
428  }
429 
430  if (auto const sig = ctx.tx[~sfSignature])
431  {
432  if (!(ctx.tx[~sfPublicKey] && bal))
433  return temMALFORMED;
434 
435  // Check the signature
436  // The signature isn't needed if txAccount == src, but if it's
437  // present, check it
438 
439  auto const reqBalance = bal->xrp();
440  auto const authAmt = amt ? amt->xrp() : reqBalance;
441 
442  if (reqBalance > authAmt)
443  return temBAD_AMOUNT;
444 
445  Keylet const k(ltPAYCHAN, ctx.tx[sfChannel]);
446  if (!publicKeyType(ctx.tx[sfPublicKey]))
447  return temMALFORMED;
448 
449  PublicKey const pk(ctx.tx[sfPublicKey]);
450  Serializer msg;
451  serializePayChanAuthorization(msg, k.key, authAmt);
452  if (!verify(pk, msg.slice(), *sig, /*canonical*/ true))
453  return temBAD_SIGNATURE;
454  }
455 
456  return preflight2(ctx);
457 }
458 
459 TER
461 {
462  Keylet const k(ltPAYCHAN, ctx_.tx[sfChannel]);
463  auto const slep = ctx_.view().peek(k);
464  if (!slep)
465  return tecNO_TARGET;
466 
467  AccountID const src = (*slep)[sfAccount];
468  AccountID const dst = (*slep)[sfDestination];
469  AccountID const txAccount = ctx_.tx[sfAccount];
470 
471  auto const curExpiration = (*slep)[~sfExpiration];
472  {
473  auto const cancelAfter = (*slep)[~sfCancelAfter];
474  auto const closeTime =
476  if ((cancelAfter && closeTime >= *cancelAfter) ||
477  (curExpiration && closeTime >= *curExpiration))
478  return closeChannel(
479  slep, ctx_.view(), k.key, ctx_.app.journal("View"));
480  }
481 
482  if (txAccount != src && txAccount != dst)
483  return tecNO_PERMISSION;
484 
485  if (ctx_.tx[~sfBalance])
486  {
487  auto const chanBalance = slep->getFieldAmount(sfBalance).xrp();
488  auto const chanFunds = slep->getFieldAmount(sfAmount).xrp();
489  auto const reqBalance = ctx_.tx[sfBalance].xrp();
490 
491  if (txAccount == dst && !ctx_.tx[~sfSignature])
492  return temBAD_SIGNATURE;
493 
494  if (ctx_.tx[~sfSignature])
495  {
496  PublicKey const pk((*slep)[sfPublicKey]);
497  if (ctx_.tx[sfPublicKey] != pk)
498  return temBAD_SIGNER;
499  }
500 
501  if (reqBalance > chanFunds)
502  return tecUNFUNDED_PAYMENT;
503 
504  if (reqBalance <= chanBalance)
505  // nothing requested
506  return tecUNFUNDED_PAYMENT;
507 
508  auto const sled = ctx_.view().peek(keylet::account(dst));
509  if (!sled)
510  return tecNO_DST;
511 
512  // Obeying the lsfDisallowXRP flag was a bug. Piggyback on
513  // featureDepositAuth to remove the bug.
514  bool const depositAuth{ctx_.view().rules().enabled(featureDepositAuth)};
515  if (!depositAuth &&
516  (txAccount == src && (sled->getFlags() & lsfDisallowXRP)))
517  return tecNO_TARGET;
518 
519  // Check whether the destination account requires deposit authorization.
520  if (depositAuth && (sled->getFlags() & lsfDepositAuth))
521  {
522  // A destination account that requires authorization has two
523  // ways to get a Payment Channel Claim into the account:
524  // 1. If Account == Destination, or
525  // 2. If Account is deposit preauthorized by destination.
526  if (txAccount != dst)
527  {
528  if (!view().exists(keylet::depositPreauth(dst, txAccount)))
529  return tecNO_PERMISSION;
530  }
531  }
532 
533  (*slep)[sfBalance] = ctx_.tx[sfBalance];
534  XRPAmount const reqDelta = reqBalance - chanBalance;
535  assert(reqDelta >= beast::zero);
536  (*sled)[sfBalance] = (*sled)[sfBalance] + reqDelta;
537  ctx_.view().update(sled);
538  ctx_.view().update(slep);
539  }
540 
541  if (ctx_.tx.getFlags() & tfRenew)
542  {
543  if (src != txAccount)
544  return tecNO_PERMISSION;
545  (*slep)[~sfExpiration] = std::nullopt;
546  ctx_.view().update(slep);
547  }
548 
549  if (ctx_.tx.getFlags() & tfClose)
550  {
551  // Channel will close immediately if dry or the receiver closes
552  if (dst == txAccount || (*slep)[sfBalance] == (*slep)[sfAmount])
553  return closeChannel(
554  slep, ctx_.view(), k.key, ctx_.app.journal("View"));
555 
556  auto const settleExpiration =
558  (*slep)[sfSettleDelay];
559 
560  if (!curExpiration || *curExpiration > settleExpiration)
561  {
562  (*slep)[~sfExpiration] = settleExpiration;
563  ctx_.view().update(slep);
564  }
565  }
566 
567  return tesSUCCESS;
568 }
569 
570 } // namespace ripple
beast::Journal::fatal
Stream fatal() const
Definition: Journal.h:338
ripple::ReadView::info
virtual LedgerInfo const & info() const =0
Returns information about the ledger.
ripple::keylet::ownerDir
Keylet ownerDir(AccountID const &id) noexcept
The root page of an account's directory.
Definition: Indexes.cpp:312
ripple::sfOwnerCount
const SF_UINT32 sfOwnerCount
ripple::preflight2
NotTEC preflight2(PreflightContext const &ctx)
Checks whether the signature appears valid.
Definition: Transactor.cpp:133
ripple::sfSourceTag
const SF_UINT32 sfSourceTag
ripple::PayChanCreate::doApply
TER doApply() override
Definition: PayChan.cpp:245
ripple::Keylet
A pair of SHAMap key and LedgerEntryType.
Definition: Keylet.h:38
ripple::tecNO_TARGET
@ tecNO_TARGET
Definition: TER.h:285
ripple::tefINTERNAL
@ tefINTERNAL
Definition: TER.h:167
ripple::Rules::enabled
bool enabled(uint256 const &feature) const
Returns true if a feature is enabled.
Definition: Rules.cpp:94
std::shared_ptr
STL class.
ripple::PreclaimContext::view
ReadView const & view
Definition: Transactor.h:56
ripple::sfOwnerNode
const SF_UINT64 sfOwnerNode
ripple::ApplyView::peek
virtual std::shared_ptr< SLE > peek(Keylet const &k)=0
Prepare to modify the SLE associated with key.
ripple::sfDestination
const SF_ACCOUNT sfDestination
ripple::describeOwnerDir
std::function< void(SLE::ref)> describeOwnerDir(AccountID const &account)
Definition: View.cpp:748
ripple::sfAmount
const SF_AMOUNT sfAmount
ripple::isTesSuccess
bool isTesSuccess(TER x)
Definition: TER.h:637
ripple::closeChannel
static TER closeChannel(std::shared_ptr< SLE > const &slep, ApplyView &view, uint256 const &key, beast::Journal j)
Definition: PayChan.cpp:116
ripple::verify
bool verify(PublicKey const &publicKey, Slice const &m, Slice const &sig, bool mustBeFullyCanonical) noexcept
Verify a signature on a message.
Definition: PublicKey.cpp:272
ripple::ApplyView::erase
virtual void erase(std::shared_ptr< SLE > const &sle)=0
Remove a peeked SLE.
ripple::ReadView::fees
virtual Fees const & fees() const =0
Returns the fees for the base ledger.
ripple::PayChanClaim::preflight
static NotTEC preflight(PreflightContext const &ctx)
Definition: PayChan.cpp:404
ripple::PayChanClaim::doApply
TER doApply() override
Definition: PayChan.cpp:460
ripple::featureDepositAuth
const uint256 featureDepositAuth
ripple::tecDST_TAG_NEEDED
@ tecDST_TAG_NEEDED
Definition: TER.h:290
ripple::tfClose
constexpr std::uint32_t tfClose
Definition: TxFlags.h:124
ripple::ApplyView::update
virtual void update(std::shared_ptr< SLE > const &sle)=0
Indicate changes to a peeked SLE.
ripple::ApplyContext::journal
const beast::Journal journal
Definition: ApplyContext.h:51
ripple::STTx::getSeqProxy
SeqProxy getSeqProxy() const
Definition: STTx.cpp:183
ripple::PayChanFund::doApply
TER doApply() override
Definition: PayChan.cpp:329
ripple::serializePayChanAuthorization
void serializePayChanAuthorization(Serializer &msg, uint256 const &key, XRPAmount const &amt)
Definition: protocol/PayChan.h:31
ripple::temDST_IS_SRC
@ temDST_IS_SRC
Definition: TER.h:107
ripple::preflight1
NotTEC preflight1(PreflightContext const &ctx)
Performs early sanity checks on the account and fee fields.
Definition: Transactor.cpp:81
ripple::lsfDepositAuth
@ lsfDepositAuth
Definition: LedgerFormats.h:265
ripple::ApplyView
Writeable view to a ledger, for applying a transaction.
Definition: ApplyView.h:134
ripple::ApplyContext::app
Application & app
Definition: ApplyContext.h:47
ripple::sfExpiration
const SF_UINT32 sfExpiration
ripple::ApplyView::dirRemove
bool dirRemove(Keylet const &directory, std::uint64_t page, uint256 const &key, bool keepRoot)
Remove an entry from a directory.
Definition: ApplyView.cpp:189
ripple::publicKeyType
std::optional< KeyType > publicKeyType(Slice const &slice)
Returns the type of public key.
Definition: PublicKey.cpp:207
ripple::Keylet::key
uint256 key
Definition: Keylet.h:40
ripple::base_uint< 256 >
ripple::temINVALID_FLAG
@ temINVALID_FLAG
Definition: TER.h:110
std::chrono::time_point::time_since_epoch
T time_since_epoch(T... args)
ripple::LedgerHeader::parentCloseTime
NetClock::time_point parentCloseTime
Definition: LedgerHeader.h:42
ripple::tefBAD_LEDGER
@ tefBAD_LEDGER
Definition: TER.h:164
ripple::adjustOwnerCount
void adjustOwnerCount(ApplyView &view, std::shared_ptr< SLE > const &sle, std::int32_t amount, beast::Journal j)
Adjust the owner count up or down.
Definition: View.cpp:730
ripple::sfSettleDelay
const SF_UINT32 sfSettleDelay
ripple::PublicKey
A public key.
Definition: PublicKey.h:61
ripple::keylet::account
Keylet account(AccountID const &id) noexcept
AccountID root.
Definition: Indexes.cpp:142
ripple::featureDisallowIncoming
const uint256 featureDisallowIncoming
ripple::temBAD_SIGNER
@ temBAD_SIGNER
Definition: TER.h:114
ripple::lsfDisallowIncomingPayChan
@ lsfDisallowIncomingPayChan
Definition: LedgerFormats.h:273
ripple::TERSubset
Definition: TER.h:380
ripple::tecUNFUNDED
@ tecUNFUNDED
Definition: TER.h:276
ripple::TER
TERSubset< CanCvtToTER > TER
Definition: TER.h:608
ripple::tecUNFUNDED_PAYMENT
@ tecUNFUNDED_PAYMENT
Definition: TER.h:266
ripple::Serializer::slice
Slice slice() const noexcept
Definition: Serializer.h:64
ripple::sfDestinationNode
const SF_UINT64 sfDestinationNode
ripple::fixPayChanRecipientOwnerDir
const uint256 fixPayChanRecipientOwnerDir
ripple::STObject::getFlags
std::uint32_t getFlags() const
Definition: STObject.cpp:481
ripple::isXRP
bool isXRP(AccountID const &c)
Definition: AccountID.h:91
ripple::temBAD_AMOUNT
@ temBAD_AMOUNT
Definition: TER.h:88
ripple::PayChanFund::preflight
static NotTEC preflight(PreflightContext const &ctx)
Definition: PayChan.cpp:314
beast::Journal
A generic endpoint for log messages.
Definition: Journal.h:58
ripple::temBAD_SIGNATURE
@ temBAD_SIGNATURE
Definition: TER.h:104
ripple::sfAMMID
const SF_UINT256 sfAMMID
ripple::tfPayChanClaimMask
constexpr std::uint32_t tfPayChanClaimMask
Definition: TxFlags.h:125
ripple::ReadView::read
virtual std::shared_ptr< SLE const > read(Keylet const &k) const =0
Return the state item associated with a key.
ripple::ApplyContext::view
ApplyView & view()
Definition: ApplyContext.h:54
ripple::tfRenew
constexpr std::uint32_t tfRenew
Definition: TxFlags.h:123
ripple::PreclaimContext::tx
STTx const & tx
Definition: Transactor.h:58
ripple::PayChanCreate::preflight
static NotTEC preflight(PreflightContext const &ctx)
Definition: PayChan.cpp:172
ripple::lsfRequireDestTag
@ lsfRequireDestTag
Definition: LedgerFormats.h:255
ripple::fix1543
const uint256 fix1543
ripple::tecDIR_FULL
@ tecDIR_FULL
Definition: TER.h:268
ripple::terNO_ACCOUNT
@ terNO_ACCOUNT
Definition: TER.h:210
ripple::PreclaimContext
State information when determining if a tx is likely to claim a fee.
Definition: Transactor.h:52
ripple::Serializer
Definition: Serializer.h:40
ripple::SeqProxy::value
constexpr std::uint32_t value() const
Definition: SeqProxy.h:82
ripple::ApplyView::insert
virtual void insert(std::shared_ptr< SLE > const &sle)=0
Insert a new state SLE.
ripple
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
Definition: RCLCensorshipDetector.h:29
ripple::Application::journal
virtual beast::Journal journal(std::string const &name)=0
ripple::Transactor::view
ApplyView & view()
Definition: Transactor.h:107
ripple::keylet::payChan
Keylet payChan(AccountID const &src, AccountID const &dst, std::uint32_t seq) noexcept
A PaymentChannel.
Definition: Indexes.cpp:333
ripple::Fees::accountReserve
XRPAmount accountReserve(std::size_t ownerCount) const
Returns the account reserve given the owner count, in drops.
Definition: protocol/Fees.h:49
ripple::ReadView::rules
virtual Rules const & rules() const =0
Returns the tx processing rules.
ripple::sfDestinationTag
const SF_UINT32 sfDestinationTag
ripple::tecNO_PERMISSION
@ tecNO_PERMISSION
Definition: TER.h:286
ripple::sfSignature
const SF_VL sfSignature
ripple::sfBalance
const SF_AMOUNT sfBalance
ripple::PayChanCreate::makeTxConsequences
static TxConsequences makeTxConsequences(PreflightContext const &ctx)
Definition: PayChan.cpp:166
ripple::tecINSUFFICIENT_RESERVE
@ tecINSUFFICIENT_RESERVE
Definition: TER.h:288
ripple::sfCancelAfter
const SF_UINT32 sfCancelAfter
ripple::Transactor::ctx_
ApplyContext & ctx_
Definition: Transactor.h:88
ripple::sfChannel
const SF_UINT256 sfChannel
ripple::lsfDisallowXRP
@ lsfDisallowXRP
Definition: LedgerFormats.h:259
ripple::sfAccount
const SF_ACCOUNT sfAccount
ripple::tecNO_ENTRY
@ tecNO_ENTRY
Definition: TER.h:287
ripple::temMALFORMED
@ temMALFORMED
Definition: TER.h:86
ripple::PreflightContext::tx
STTx const & tx
Definition: Transactor.h:35
ripple::PreflightContext
State information when preflighting a tx.
Definition: Transactor.h:31
ripple::temBAD_EXPIRATION
@ temBAD_EXPIRATION
Definition: TER.h:90
ripple::ApplyView::dirInsert
std::optional< std::uint64_t > dirInsert(Keylet const &directory, uint256 const &key, std::function< void(std::shared_ptr< SLE > const &)> const &describe)
Insert an entry to a directory.
Definition: ApplyView.h:306
ripple::PreflightContext::rules
const Rules rules
Definition: Transactor.h:36
ripple::tfUniversalMask
constexpr std::uint32_t tfUniversalMask
Definition: TxFlags.h:60
ripple::keylet::depositPreauth
Keylet depositPreauth(AccountID const &owner, AccountID const &preauthorized) noexcept
A DepositPreauth.
Definition: Indexes.cpp:296
ripple::TxConsequences
Class describing the consequences to the account of applying a transaction if the transaction consume...
Definition: applySteps.h:45
ripple::tesSUCCESS
@ tesSUCCESS
Definition: TER.h:236
ripple::sfPublicKey
const SF_VL sfPublicKey
ripple::ApplyContext::tx
STTx const & tx
Definition: ApplyContext.h:48
ripple::tecNO_DST
@ tecNO_DST
Definition: TER.h:271
ripple::PayChanFund::makeTxConsequences
static TxConsequences makeTxConsequences(PreflightContext const &ctx)
Definition: PayChan.cpp:308
ripple::ltPAYCHAN
@ ltPAYCHAN
A ledger object describing a single unidirectional XRP payment channel.
Definition: LedgerFormats.h:149
ripple::XRPAmount
Definition: XRPAmount.h:46
ripple::PayChanCreate::preclaim
static TER preclaim(PreclaimContext const &ctx)
Definition: PayChan.cpp:193