rippled
SignerEntries.h
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 #ifndef RIPPLE_TX_IMPL_SIGNER_ENTRIES_H_INCLUDED
21 #define RIPPLE_TX_IMPL_SIGNER_ENTRIES_H_INCLUDED
22 
23 #include <ripple/app/tx/impl/Transactor.h> // NotTEC
24 #include <ripple/basics/Expected.h> //
25 #include <ripple/beast/utility/Journal.h> // beast::Journal
26 #include <ripple/protocol/Rules.h> // Rules
27 #include <ripple/protocol/STTx.h> // STTx::maxMultiSigners
28 #include <ripple/protocol/TER.h> // temMALFORMED
29 #include <ripple/protocol/UintTypes.h> // AccountID
30 #include <optional>
31 
32 namespace ripple {
33 
34 // Forward declarations
35 class STObject;
36 
37 // Support for SignerEntries that is needed by a few Transactors
39 {
40 public:
41  explicit SignerEntries() = default;
42 
43  struct SignerEntry
44  {
48 
50  AccountID const& inAccount,
51  std::uint16_t inWeight,
53  : account(inAccount), weight(inWeight), tag(inTag)
54  {
55  }
56 
57  // For sorting to look for duplicate accounts
58  friend bool
59  operator<(SignerEntry const& lhs, SignerEntry const& rhs)
60  {
61  return lhs.account < rhs.account;
62  }
63 
64  friend bool
65  operator==(SignerEntry const& lhs, SignerEntry const& rhs)
66  {
67  return lhs.account == rhs.account;
68  }
69  };
70 
71  // Deserialize a SignerEntries array from the network or from the ledger.
74  STObject const& obj,
75  beast::Journal journal,
76  std::string const& annotation);
77 };
78 
79 } // namespace ripple
80 
81 #endif // RIPPLE_TX_IMPL_SIGNER_ENTRIES_H_INCLUDED
std::string
STL class.
ripple::SignerEntries::deserialize
static Expected< std::vector< SignerEntry >, NotTEC > deserialize(STObject const &obj, beast::Journal journal, std::string const &annotation)
Definition: SignerEntries.cpp:30
ripple::SignerEntries
Definition: SignerEntries.h:38
ripple::SignerEntries::SignerEntry
Definition: SignerEntries.h:43
ripple::SignerEntries::SignerEntry::account
AccountID account
Definition: SignerEntries.h:45
ripple::base_uint< 160, detail::AccountIDTag >
ripple::Expected
Definition: Expected.h:132
ripple::SignerEntries::SignerEntry::weight
std::uint16_t weight
Definition: SignerEntries.h:46
ripple::SignerEntries::SignerEntry::operator==
friend bool operator==(SignerEntry const &lhs, SignerEntry const &rhs)
Definition: SignerEntries.h:65
ripple::TERSubset
Definition: TER.h:340
ripple::SignerEntries::SignerEntry::tag
std::optional< uint256 > tag
Definition: SignerEntries.h:47
ripple::SignerEntries::SignerEntry::SignerEntry
SignerEntry(AccountID const &inAccount, std::uint16_t inWeight, std::optional< uint256 > inTag)
Definition: SignerEntries.h:49
beast::Journal
A generic endpoint for log messages.
Definition: Journal.h:58
std::uint16_t
ripple::SignerEntries::SignerEntry::operator<
friend bool operator<(SignerEntry const &lhs, SignerEntry const &rhs)
Definition: SignerEntries.h:59
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
optional
ripple::SignerEntries::SignerEntries
SignerEntries()=default