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