rippled
Loading...
Searching...
No Matches
SignerEntries.cpp
1#include <xrpld/app/tx/detail/SignerEntries.h>
2
3#include <xrpl/basics/Log.h>
4#include <xrpl/protocol/STArray.h>
5#include <xrpl/protocol/STObject.h>
6
7#include <cstdint>
8#include <optional>
9
10namespace xrpl {
11
12Expected<std::vector<SignerEntries::SignerEntry>, NotTEC>
14{
16
17 if (!obj.isFieldPresent(sfSignerEntries))
18 {
19 JLOG(journal.trace()) << "Malformed " << annotation << ": Need signer entry array.";
21 }
22
23 std::vector<SignerEntry> accountVec;
25
26 STArray const& sEntries(obj.getFieldArray(sfSignerEntries));
27 for (STObject const& sEntry : sEntries)
28 {
29 // Validate the SignerEntry.
30 if (sEntry.getFName() != sfSignerEntry)
31 {
32 JLOG(journal.trace()) << "Malformed " << annotation << ": Expected SignerEntry.";
34 }
35
36 // Extract SignerEntry fields.
37 AccountID const account = sEntry.getAccountID(sfAccount);
38 std::uint16_t const weight = sEntry.getFieldU16(sfSignerWeight);
39 std::optional<uint256> const tag = sEntry.at(~sfWalletLocator);
40
41 accountVec.emplace_back(account, weight, tag);
42 }
43 return accountVec;
44}
45
46} // namespace xrpl
A generic endpoint for log messages.
Definition Journal.h:41
Stream trace() const
Severity stream access functions.
Definition Journal.h:295
STArray const & getFieldArray(SField const &field) const
Definition STObject.cpp:663
bool isFieldPresent(SField const &field) const
Definition STObject.cpp:439
static constexpr std::size_t maxMultiSigners
Definition STTx.h:35
static Expected< std::vector< SignerEntry >, NotTEC > deserialize(STObject const &obj, beast::Journal journal, std::string_view annotation)
T emplace_back(T... args)
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
Definition algorithm.h:6
@ temMALFORMED
Definition TER.h:68
TERSubset< CanCvtToNotTEC > NotTEC
Definition TER.h:581
T reserve(T... args)