20 #ifndef RIPPLE_PROTOCOL_STVALIDATION_H_INCLUDED
21 #define RIPPLE_PROTOCOL_STVALIDATION_H_INCLUDED
23 #include <ripple/basics/FeeUnits.h>
24 #include <ripple/basics/Log.h>
25 #include <ripple/protocol/PublicKey.h>
26 #include <ripple/protocol/STObject.h>
27 #include <ripple/protocol/SecretKey.h>
75 template <
class LookupNodeID>
78 LookupNodeID&& lookupNodeID,
149 copy(
std::
size_t n,
void* buf) const override;
151 move(
std::
size_t n,
void* buf) override;
153 friend class detail::STVar;
156 template <class LookupNodeID>
159 LookupNodeID&& lookupNodeID,
166 Throw<std::runtime_error>(
"Invalid public key in validation");
172 if (checkSignature && !
isValid())
174 JLOG(
debugLog().error()) <<
"Invalid signature in validation: "
176 Throw<std::runtime_error>(
"Invalid signature in validation");
190 template <
typename F>
206 LogicError(
"We can only use secp256k1 keys for signing validations");
224 "Required field '" + e.sField().getName() +
225 "' missing from validation.");
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)
uint256 getConsensusHash() const
Tracks the number of instances of an object.
const SF_VL sfSigningPubKey
uint256 getLedgerHash() const
const PublicKey signingPubKey_
NodeID const & getNodeID() const noexcept
Slice slice() const noexcept
STBase * copy(std::size_t n, void *buf) const override
void setFieldVL(SField const &field, Blob const &)
Blob getFieldVL(SField const &field) const
static SOTemplate const & validationFormat()
Blob getSignature() const
beast::Journal debugLog()
Returns a debug journal.
bool isTrusted() const noexcept
constexpr std::uint32_t vfFullyCanonicalSig
std::optional< KeyType > publicKeyType(Slice const &slice)
Returns the type of public key.
T time_since_epoch(T... args)
Defines the fields and their attributes within a STObject.
PublicKey const & getSignerPublic() const noexcept
std::optional< bool > valid_
Buffer signDigest(PublicKey const &pk, SecretKey const &sk, uint256 const &digest)
Generate a signature for a message digest.
Blob getSerialized() const
STBase * move(std::size_t n, void *buf) override
bool isFull() const noexcept
void setSeen(NetClock::time_point s)
NetClock::time_point getSignTime() const
NetClock::time_point seenTime_
bool isValid() const noexcept
Use hash_* containers for keys that do not need a cryptographically secure hashing algorithm.
A type which can be exported to a well known binary format.
void LogicError(std::string const &how) noexcept
Called when faulty logic causes a broken invariant.
bool isFieldPresent(SField const &field) const
NetClock::time_point getSeenTime() const noexcept
bool setFlag(std::uint32_t)
uint256 getSigningHash() const
const SField sfValidation
constexpr std::uint32_t vfFullValidation
Clock for measuring the network time.
Json::Value getJson(JsonOptions options) const override
void setFieldU32(SField const &field, std::uint32_t)
const SF_UINT32 sfSigningTime
STValidation(SerialIter &sit, LookupNodeID &&lookupNodeID, bool checkSignature)
Construct a STValidation from a peer from serialized data.