rippled
STTx.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/protocol/STTx.h>
21 #include <ripple/basics/contract.h>
22 #include <ripple/basics/Log.h>
23 #include <ripple/basics/safe_cast.h>
24 #include <ripple/basics/StringUtilities.h>
25 #include <ripple/protocol/Feature.h>
26 #include <ripple/protocol/HashPrefix.h>
27 #include <ripple/protocol/jss.h>
28 #include <ripple/protocol/Protocol.h>
29 #include <ripple/protocol/PublicKey.h>
30 #include <ripple/protocol/Sign.h>
31 #include <ripple/protocol/STAccount.h>
32 #include <ripple/protocol/STArray.h>
33 #include <ripple/protocol/TxFlags.h>
34 #include <ripple/protocol/UintTypes.h>
35 #include <ripple/json/to_string.h>
36 #include <boost/format.hpp>
37 #include <array>
38 #include <memory>
39 #include <type_traits>
40 #include <utility>
41 
42 namespace ripple {
43 
44 static
45 auto getTxFormat (TxType type)
46 {
47  auto format = TxFormats::getInstance().findByType (type);
48 
49  if (format == nullptr)
50  {
51  Throw<std::runtime_error> (
52  "Invalid transaction type " +
55  }
56 
57  return format;
58 }
59 
60 STTx::STTx (STObject&& object) noexcept (false)
61  : STObject (std::move (object))
62 {
63  tx_type_ = safe_cast<TxType> (getFieldU16 (sfTransactionType));
64  applyTemplate (getTxFormat (tx_type_)->getSOTemplate()); // may throw
65  tid_ = getHash(HashPrefix::transactionID);
66 }
67 
68 STTx::STTx (SerialIter& sit) noexcept (false)
70 {
71  int length = sit.getBytesLeft ();
72 
73  if ((length < txMinSizeBytes) || (length > txMaxSizeBytes))
74  Throw<std::runtime_error> ("Transaction length invalid");
75 
76  if (set (sit))
77  Throw<std::runtime_error> ("Transaction contains an object terminator");
78 
79  tx_type_ = safe_cast<TxType> (getFieldU16 (sfTransactionType));
80 
81  applyTemplate (getTxFormat (tx_type_)->getSOTemplate()); // May throw
82  tid_ = getHash(HashPrefix::transactionID);
83 }
84 
86  TxType type,
87  std::function<void(STObject&)> assembler)
89 {
90  auto format = getTxFormat (type);
91 
92  set (format->getSOTemplate());
93  setFieldU16 (sfTransactionType, format->getType ());
94 
95  assembler (*this);
96 
97  tx_type_ = safe_cast<TxType>(getFieldU16 (sfTransactionType));
98 
99  if (tx_type_ != type)
100  LogicError ("Transaction type was mutated during assembly");
101 
103 }
104 
107 {
108  std::string ret = "\"";
109  ret += to_string (getTransactionID ());
110  ret += "\" = {";
111  ret += STObject::getFullText ();
112  ret += "}";
113  return ret;
114 }
115 
116 boost::container::flat_set<AccountID>
118 {
119  boost::container::flat_set<AccountID> list;
120 
121  for (auto const& it : *this)
122  {
123  if (auto sacc = dynamic_cast<STAccount const*> (&it))
124  {
125  assert(! sacc->isDefault());
126  if (! sacc->isDefault())
127  list.insert(sacc->value());
128  }
129  else if (auto samt = dynamic_cast<STAmount const*> (&it))
130  {
131  auto const& issuer = samt->getIssuer ();
132  if (! isXRP (issuer))
133  list.insert(issuer);
134  }
135  }
136 
137  return list;
138 }
139 
140 static Blob getSigningData (STTx const& that)
141 {
142  Serializer s;
144  that.addWithoutSigningFields (s);
145  return s.getData();
146 }
147 
148 uint256
150 {
152 }
153 
155 {
156  try
157  {
158  return getFieldVL (sfTxnSignature);
159  }
160  catch (std::exception const&)
161  {
162  return Blob ();
163  }
164 }
165 
167  PublicKey const& publicKey,
168  SecretKey const& secretKey)
169 {
170  auto const data = getSigningData (*this);
171 
172  auto const sig = ripple::sign (
173  publicKey,
174  secretKey,
175  makeSlice(data));
176 
177  setFieldVL (sfTxnSignature, sig);
179 }
180 
182 STTx::checkSign(RequireFullyCanonicalSig requireCanonicalSig) const
183 {
184  std::pair<bool, std::string> ret {false, ""};
185  try
186  {
187  // Determine whether we're single- or multi-signing by looking
188  // at the SigningPubKey. It it's empty we must be
189  // multi-signing. Otherwise we're single-signing.
190  Blob const& signingPubKey = getFieldVL (sfSigningPubKey);
191  ret = signingPubKey.empty () ?
192  checkMultiSign (requireCanonicalSig) :
193  checkSingleSign (requireCanonicalSig);
194  }
195  catch (std::exception const&)
196  {
197  ret = {false, "Internal signature check failure."};
198  }
199  return ret;
200 }
201 
203 {
205  ret[jss::hash] = to_string (getTransactionID ());
206  return ret;
207 }
208 
209 Json::Value STTx::getJson (JsonOptions options, bool binary) const
210 {
211  if (binary)
212  {
213  Json::Value ret;
215  ret[jss::tx] = strHex (s.peekData ());
216  ret[jss::hash] = to_string (getTransactionID ());
217  return ret;
218  }
219  return getJson(options);
220 }
221 
222 std::string const&
224 {
225  static std::string const sql = "INSERT OR REPLACE INTO Transactions "
226  "(TransID, TransType, FromAcct, FromSeq, LedgerSeq, Status, RawTxn, TxnMeta)"
227  " VALUES ";
228 
229  return sql;
230 }
231 
233  std::string const& escapedMetaData) const
234 {
235  Serializer s;
236  add (s);
237  return getMetaSQL (s, inLedger, txnSqlValidated, escapedMetaData);
238 }
239 
240 // VFALCO This could be a free function elsewhere
243  std::uint32_t inLedger, char status, std::string const& escapedMetaData) const
244 {
245  static boost::format bfTrans ("('%s', '%s', '%s', '%d', '%d', '%c', %s, %s)");
246  std::string rTxn = sqlEscape (rawTxn.peekData ());
247 
248  auto format = TxFormats::getInstance().findByType (tx_type_);
249  assert (format != nullptr);
250 
251  return str (boost::format (bfTrans)
252  % to_string (getTransactionID ()) % format->getName ()
254  % getSequence () % inLedger % status % rTxn % escapedMetaData);
255 }
256 
259 {
260  // We don't allow both a non-empty sfSigningPubKey and an sfSigners.
261  // That would allow the transaction to be signed two ways. So if both
262  // fields are present the signature is invalid.
264  return {false, "Cannot both single- and multi-sign."};
265 
266  bool validSig = false;
267  try
268  {
269  bool const fullyCanonical =
271  (requireCanonicalSig == RequireFullyCanonicalSig::yes);
272 
273  auto const spk = getFieldVL (sfSigningPubKey);
274 
275  if (publicKeyType (makeSlice(spk)))
276  {
277  Blob const signature = getFieldVL (sfTxnSignature);
278  Blob const data = getSigningData (*this);
279 
280  validSig = verify (
281  PublicKey (makeSlice(spk)),
282  makeSlice(data),
283  makeSlice(signature),
285  }
286  }
287  catch (std::exception const&)
288  {
289  // Assume it was a signature failure.
290  validSig = false;
291  }
292  if (validSig == false)
293  return {false, "Invalid signature."};
294 
295  return {true, ""};
296 }
297 
300 {
301  // Make sure the MultiSigners are present. Otherwise they are not
302  // attempting multi-signing and we just have a bad SigningPubKey.
303  if (!isFieldPresent (sfSigners))
304  return {false, "Empty SigningPubKey."};
305 
306  // We don't allow both an sfSigners and an sfTxnSignature. Both fields
307  // being present would indicate that the transaction is signed both ways.
309  return {false, "Cannot both single- and multi-sign."};
310 
311  STArray const& signers {getFieldArray (sfSigners)};
312 
313  // There are well known bounds that the number of signers must be within.
314  if (signers.size() < minMultiSigners || signers.size() > maxMultiSigners)
315  return {false, "Invalid Signers array size."};
316 
317  // We can ease the computational load inside the loop a bit by
318  // pre-constructing part of the data that we hash. Fill a Serializer
319  // with the stuff that stays constant from signature to signature.
320  Serializer const dataStart {startMultiSigningData (*this)};
321 
322  // We also use the sfAccount field inside the loop. Get it once.
323  auto const txnAccountID = getAccountID (sfAccount);
324 
325  // Determine whether signatures must be full canonical.
326  bool const fullyCanonical =
328  (requireCanonicalSig == RequireFullyCanonicalSig::yes);
329 
330  // Signers must be in sorted order by AccountID.
331  AccountID lastAccountID (beast::zero);
332 
333  for (auto const& signer : signers)
334  {
335  auto const accountID = signer.getAccountID (sfAccount);
336 
337  // The account owner may not multisign for themselves.
338  if (accountID == txnAccountID)
339  return {false, "Invalid multisigner."};
340 
341  // No duplicate signers allowed.
342  if (lastAccountID == accountID)
343  return {false, "Duplicate Signers not allowed."};
344 
345  // Accounts must be in order by account ID. No duplicates allowed.
346  if (lastAccountID > accountID)
347  return {false, "Unsorted Signers array."};
348 
349  // The next signature must be greater than this one.
350  lastAccountID = accountID;
351 
352  // Verify the signature.
353  bool validSig = false;
354  try
355  {
356  Serializer s = dataStart;
357  finishMultiSigningData (accountID, s);
358 
359  auto spk = signer.getFieldVL (sfSigningPubKey);
360 
361  if (publicKeyType (makeSlice(spk)))
362  {
363  Blob const signature =
364  signer.getFieldVL (sfTxnSignature);
365 
366  validSig = verify (
367  PublicKey (makeSlice(spk)),
368  s.slice(),
369  makeSlice(signature),
371  }
372  }
373  catch (std::exception const&)
374  {
375  // We assume any problem lies with the signature.
376  validSig = false;
377  }
378  if (!validSig)
379  return {false, std::string("Invalid signature on account ") +
380  toBase58(accountID) + "."};
381  }
382 
383  // All signatures verified.
384  return {true, ""};
385 }
386 
387 //------------------------------------------------------------------------------
388 
389 static
390 bool
391 isMemoOkay (STObject const& st, std::string& reason)
392 {
393  if (!st.isFieldPresent (sfMemos))
394  return true;
395 
396  auto const& memos = st.getFieldArray (sfMemos);
397 
398  // The number 2048 is a preallocation hint, not a hard limit
399  // to avoid allocate/copy/free's
400  Serializer s (2048);
401  memos.add (s);
402 
403  // FIXME move the memo limit into a config tunable
404  if (s.getDataLength () > 1024)
405  {
406  reason = "The memo exceeds the maximum allowed size.";
407  return false;
408  }
409 
410  for (auto const& memo : memos)
411  {
412  auto memoObj = dynamic_cast <STObject const*> (&memo);
413 
414  if (!memoObj || (memoObj->getFName() != sfMemo))
415  {
416  reason = "A memo array may contain only Memo objects.";
417  return false;
418  }
419 
420  for (auto const& memoElement : *memoObj)
421  {
422  auto const& name = memoElement.getFName();
423 
424  if (name != sfMemoType &&
425  name != sfMemoData &&
426  name != sfMemoFormat)
427  {
428  reason = "A memo may contain only MemoType, MemoData or "
429  "MemoFormat fields.";
430  return false;
431  }
432 
433  // The raw data is stored as hex-octets, which we want to decode.
434  auto optData = strUnHex (memoElement.getText ());
435 
436  if (!optData)
437  {
438  reason = "The MemoType, MemoData and MemoFormat fields may "
439  "only contain hex-encoded data.";
440  return false;
441  }
442 
443  if (name == sfMemoData)
444  continue;
445 
446  // The only allowed characters for MemoType and MemoFormat are the
447  // characters allowed in URLs per RFC 3986: alphanumerics and the
448  // following symbols: -._~:/?#[]@!$&'()*+,;=%
449  static std::array<char, 256> const allowedSymbols = []
450  {
452  a.fill(0);
453 
454  std::string symbols (
455  "0123456789"
456  "-._~:/?#[]@!$&'()*+,;=%"
457  "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
458  "abcdefghijklmnopqrstuvwxyz");
459 
460  for(char c : symbols)
461  a[c] = 1;
462  return a;
463  }();
464 
465  for (auto c : *optData)
466  {
467  if (!allowedSymbols[c])
468  {
469  reason = "The MemoType and MemoFormat fields may only "
470  "contain characters that are allowed in URLs "
471  "under RFC 3986.";
472  return false;
473  }
474  }
475  }
476  }
477 
478  return true;
479 }
480 
481 // Ensure all account fields are 160-bits
482 static
483 bool
485 {
486  for (int i = 0; i < st.getCount(); ++i)
487  {
488  auto t = dynamic_cast<STAccount const*>(st.peekAtPIndex (i));
489  if (t && t->isDefault ())
490  return false;
491  }
492 
493  return true;
494 }
495 
496 bool passesLocalChecks (STObject const& st, std::string& reason)
497 {
498  if (!isMemoOkay (st, reason))
499  return false;
500 
501  if (!isAccountFieldOkay (st))
502  {
503  reason = "An account field is invalid.";
504  return false;
505  }
506 
507  if (isPseudoTx(st))
508  {
509  reason = "Cannot submit pseudo transactions.";
510  return false;
511  }
512  return true;
513 }
514 
516 sterilize (STTx const& stx)
517 {
518  Serializer s;
519  stx.add(s);
520  SerialIter sit(s.slice());
521  return std::make_shared<STTx const>(std::ref(sit));
522 }
523 
524 bool
526 {
527  auto t = tx[~sfTransactionType];
528  if (!t)
529  return false;
530  auto tt = safe_cast<TxType>(*t);
531  return tt == ttAMENDMENT || tt == ttFEE;
532 }
533 
534 } // ripple
ripple::getTxFormat
static auto getTxFormat(TxType type)
Definition: STTx.cpp:45
ripple::isAccountFieldOkay
static bool isAccountFieldOkay(STObject const &st)
Definition: STTx.cpp:484
ripple::STTx::checkMultiSign
std::pair< bool, std::string > checkMultiSign(RequireFullyCanonicalSig requireCanonicalSig) const
Definition: STTx.cpp:299
ripple::STObject::getFieldArray
const STArray & getFieldArray(SField const &field) const
Definition: STObject.cpp:567
ripple::STTx::getMetaSQL
std::string getMetaSQL(std::uint32_t inLedger, std::string const &escapedMetaData) const
Definition: STTx.cpp:232
ripple::makeSlice
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:199
std::string
STL class.
std::shared_ptr
STL class.
ripple::STTx::checkSign
std::pair< bool, std::string > checkSign(RequireFullyCanonicalSig requireCanonicalSig) const
Definition: STTx.cpp:182
utility
std::exception
STL class.
ripple::STObject::setFieldU16
void setFieldU16(SField const &field, std::uint16_t)
Definition: STObject.cpp:596
ripple::JsonOptions
JsonOptions
Definition: STBase.h:34
ripple::publicKeyType
boost::optional< KeyType > publicKeyType(Slice const &slice)
Returns the type of public key.
Definition: PublicKey.cpp:207
ripple::sfSigners
const SField sfSigners(access, STI_ARRAY, 3, "Signers", SField::sMD_Default, SField::notSigning)
Definition: SField.h:495
std::pair
ripple::sfMemoType
const SF_Blob sfMemoType(access, STI_VL, 12, "MemoType")
Definition: SField.h:450
ripple::sfSigningPubKey
const SF_Blob sfSigningPubKey(access, STI_VL, 3, "SigningPubKey")
Definition: SField.h:442
ripple::txMinSizeBytes
constexpr std::size_t txMinSizeBytes
Protocol specific constants, types, and data.
Definition: Protocol.h:39
std::vector< unsigned char >
ripple::sfAccount
const SF_Account sfAccount(access, STI_ACCOUNT, 1, "Account")
Definition: SField.h:460
ripple::toBase58
std::string toBase58(AccountID const &v)
Convert AccountID to base58 checked string.
Definition: AccountID.cpp:29
ripple::STObject::getSerializer
Serializer getSerializer() const
Definition: STObject.h:356
ripple::STTx::getSigningHash
uint256 getSigningHash() const
Definition: STTx.cpp:149
ripple::Serializer::add32
int add32(std::uint32_t)
Definition: Serializer.cpp:46
ripple::strUnHex
boost::optional< Blob > strUnHex(std::size_t strSize, Iterator begin, Iterator end)
Definition: StringUtilities.h:69
ripple::STTx::getMetaSQLInsertReplaceHeader
static std::string const & getMetaSQLInsertReplaceHeader()
Definition: STTx.cpp:223
std::function
ripple::sqlEscape
static std::string sqlEscape(std::string const &strSrc)
Definition: StringUtilities.h:33
ripple::to_string
std::string to_string(ListDisposition disposition)
Definition: ValidatorList.cpp:41
ripple::STObject::setFieldVL
void setFieldVL(SField const &field, Blob const &)
Definition: STObject.cpp:631
ripple::STObject::getFieldVL
Blob getFieldVL(SField const &field) const
Definition: STObject.cpp:542
ripple::STObject::peekAtPIndex
const STBase * peekAtPIndex(int offset) const
Definition: STObject.h:398
ripple::ECDSACanonicality::fullyCanonical
@ fullyCanonical
ripple::finishMultiSigningData
void finishMultiSigningData(AccountID const &signingID, Serializer &s)
Definition: Sign.h:80
std::array::fill
T fill(T... args)
ripple::STObject::getFullText
virtual std::string getFullText() const override
Definition: STObject.cpp:237
ripple::uint256
base_uint< 256 > uint256
Definition: base_uint.h:436
std::underlying_type_t
ripple::ttFEE
@ ttFEE
Definition: TxFormats.h:61
ripple::sfMemoData
const SF_Blob sfMemoData(access, STI_VL, 13, "MemoData")
Definition: SField.h:451
ripple::verify
bool verify(PublicKey const &publicKey, Slice const &m, Slice const &sig, bool mustBeFullyCanonical)
Verify a signature on a message.
Definition: PublicKey.cpp:277
ripple::Serializer::getDataLength
int getDataLength() const
Definition: Serializer.h:186
ripple::base_uint< 160, detail::AccountIDTag >
ripple::isPseudoTx
bool isPseudoTx(STObject const &tx)
Check whether a transaction is a pseudo-transaction.
Definition: STTx.cpp:525
ripple::getSigningData
static Blob getSigningData(STTx const &that)
Definition: STTx.cpp:140
ripple::passesLocalChecks
bool passesLocalChecks(STObject const &st, std::string &reason)
Definition: STTx.cpp:496
ripple::TxFormats::getInstance
static TxFormats const & getInstance()
Definition: TxFormats.cpp:236
ripple::PublicKey
A public key.
Definition: PublicKey.h:59
ripple::STObject::getAccountID
AccountID getAccountID(SField const &field) const
Definition: STObject.cpp:537
ripple::JsonOptions::none
@ none
ripple::STTx::getFullText
std::string getFullText() const override
Definition: STTx.cpp:106
ripple::safe_cast
constexpr std::enable_if_t< std::is_same_v< typename Dest::unit_type, typename Src::unit_type > &&std::is_integral_v< typename Dest::value_type > &&std::is_integral_v< typename Src::value_type >, Dest > safe_cast(Src s) noexcept
Definition: FeeUnits.h:553
ripple::KnownFormats::findByType
Item const * findByType(KeyType type) const
Retrieve a format based on its type.
Definition: KnownFormats.h:120
ripple::startMultiSigningData
Serializer startMultiSigningData(STObject const &obj)
Break the multi-signing hash computation into 2 parts for optimization.
Definition: Sign.cpp:91
ripple::STArray
Definition: STArray.h:28
ripple::sfTransaction
const SField sfTransaction(access, STI_TRANSACTION, 257, "Transaction")
Definition: SField.h:319
std::to_string
T to_string(T... args)
ripple::isMemoOkay
static bool isMemoOkay(STObject const &st, std::string &reason)
Definition: STTx.cpp:391
ripple::tfFullyCanonicalSig
const std::uint32_t tfFullyCanonicalSig
Definition: TxFlags.h:48
ripple::set
bool set(T &target, std::string const &name, Section const &section)
Set a value from a configuration Section If the named value is not found or doesn't parse as a T,...
Definition: BasicConfig.h:271
array
ripple::sfTxnSignature
const SF_Blob sfTxnSignature(access, STI_VL, 4, "TxnSignature", SField::sMD_Default, SField::notSigning)
Definition: SField.h:443
ripple::sfTransactionType
const SF_U16 sfTransactionType(access, STI_UINT16, 2, "TransactionType")
Definition: SField.h:331
ripple::STAmount
Definition: STAmount.h:42
ripple::Serializer::slice
Slice slice() const noexcept
Definition: Serializer.h:67
Json::Value::size
UInt size() const
Number of values in array or object.
Definition: json_value.cpp:720
ripple::txnSqlValidated
@ txnSqlValidated
Definition: STTx.h:38
ripple::STObject::getFlags
std::uint32_t getFlags() const
Definition: STObject.cpp:439
ripple::STTx
Definition: STTx.h:43
ripple::isXRP
bool isXRP(AccountID const &c)
Definition: AccountID.h:121
ripple::SerialIter
Definition: Serializer.h:311
ripple::HashPrefix::transactionID
@ transactionID
transaction plus signature to give transaction ID
std::uint32_t
ripple::STTx::checkSingleSign
std::pair< bool, std::string > checkSingleSign(RequireFullyCanonicalSig requireCanonicalSig) const
Definition: STTx.cpp:258
ripple::SecretKey
A secret key.
Definition: SecretKey.h:36
ripple::STObject::addWithoutSigningFields
void addWithoutSigningFields(Serializer &s) const
Definition: STObject.h:348
ripple::txMaxSizeBytes
constexpr std::size_t txMaxSizeBytes
Largest legal byte size of a transaction.
Definition: Protocol.h:42
ripple::ttAMENDMENT
@ ttAMENDMENT
Definition: TxFormats.h:60
ripple::STTx::sign
void sign(PublicKey const &publicKey, SecretKey const &secretKey)
Definition: STTx.cpp:166
ripple::STObject::getFieldU16
std::uint16_t getFieldU16(SField const &field) const
Definition: STObject.cpp:507
ripple::STTx::getJson
Json::Value getJson(JsonOptions options) const override
Definition: STTx.cpp:202
memory
ripple::STTx::getSequence
std::uint32_t getSequence() const
Definition: STTx.h:108
ripple::STTx::getTransactionID
uint256 getTransactionID() const
Definition: STTx.h:120
ripple::Serializer
Definition: Serializer.h:43
ripple::STAccount
Definition: STAccount.h:29
ripple::sfMemo
const SField sfMemo(access, STI_OBJECT, 10, "Memo")
Definition: SField.h:487
ripple::TxType
TxType
Transaction type identifiers.
Definition: TxFormats.h:33
ripple::STObject
Definition: STObject.h:51
ripple
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
Definition: RCLCensorshipDetector.h:29
ripple::sterilize
std::shared_ptr< STTx const > sterilize(STTx const &stx)
Sterilize a transaction.
Definition: STTx.cpp:516
ripple::STTx::maxMultiSigners
static const std::size_t maxMultiSigners
Definition: STTx.h:51
ripple::STObject::getSigningHash
uint256 getSigningHash(HashPrefix prefix) const
Definition: STObject.cpp:318
ripple::STTx::RequireFullyCanonicalSig::yes
@ yes
ripple::STObject::add
virtual void add(Serializer &s) const override
Definition: STObject.h:343
ripple::STTx::STTx
STTx()=delete
ripple::sign
Buffer sign(PublicKey const &pk, SecretKey const &sk, Slice const &m)
Generate a signature for a message.
Definition: SecretKey.cpp:132
ripple::STTx::getSignature
Blob getSignature() const
Definition: STTx.cpp:154
std
STL namespace.
ripple::LogicError
void LogicError(std::string const &how) noexcept
Called when faulty logic causes a broken invariant.
Definition: contract.cpp:50
ripple::STObject::isFieldPresent
bool isFieldPresent(SField const &field) const
Definition: STObject.cpp:392
ripple::STTx::tid_
uint256 tid_
Definition: STTx.h:164
ripple::Serializer::peekData
Blob const & peekData() const
Definition: Serializer.h:173
ripple::STTx::getMentionedAccounts
boost::container::flat_set< AccountID > getMentionedAccounts() const
Definition: STTx.cpp:117
ripple::sfMemos
const SField sfMemos(access, STI_ARRAY, 9, "Memos")
Definition: SField.h:501
std::vector::empty
T empty(T... args)
ripple::STTx::minMultiSigners
static const std::size_t minMultiSigners
Definition: STTx.h:50
ripple::Blob
std::vector< unsigned char > Blob
Storage for linear binary data.
Definition: Blob.h:30
ripple::STObject::getCount
int getCount() const
Definition: STObject.h:377
ripple::strHex
std::string strHex(FwdIt begin, FwdIt end)
Definition: strHex.h:70
ripple::Serializer::getData
Blob getData() const
Definition: Serializer.h:177
ripple::HashPrefix::txSign
@ txSign
inner transaction to sign
ripple::STObject::getJson
virtual Json::Value getJson(JsonOptions options) const override
Definition: STObject.cpp:657
ripple::STObject::set
void set(const SOTemplate &)
Definition: STObject.cpp:88
ripple::STTx::RequireFullyCanonicalSig
RequireFullyCanonicalSig
Check the signature.
Definition: STTx.h:135
type_traits
std::ref
T ref(T... args)
ripple::sfMemoFormat
const SF_Blob sfMemoFormat(access, STI_VL, 14, "MemoFormat")
Definition: SField.h:452
Json::Value
Represents a JSON value.
Definition: json_value.h:141
ripple::STTx::tx_type_
TxType tx_type_
Definition: STTx.h:165
ripple::STObject::getHash
uint256 getHash(HashPrefix prefix) const
Definition: STObject.cpp:310