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>
62 template <
class LookupNodeID>
65 LookupNodeID&& lookupNodeID,
73 JLOG(
debugLog().error()) <<
"Invalid public key in validation: "
75 Throw<std::runtime_error>(
"Invalid public key in validation");
78 if (checkSignature && !
isValid())
80 JLOG(
debugLog().error()) <<
"Invalid signature in validation: "
82 Throw<std::runtime_error>(
"Invalid signature in validation");
111 "We can only use secp256k1 keys for signing validations");
129 "Required field '" + e.sField().getName() +
130 "' missing from validation.");
143 return emplace(n, buf, std::move(*
this));
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)
STBase * move(std::size_t n, void *buf) override
uint256 getConsensusHash() const
Tracks the number of instances of an object.
boost::optional< KeyType > publicKeyType(Slice const &slice)
Returns the type of public key.
const SF_VL sfSigningPubKey
STBase * copy(std::size_t n, void *buf) const override
uint256 getLedgerHash() const
Slice slice() const noexcept
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.
constexpr std::uint32_t vfFullyCanonicalSig
static STBase * emplace(std::size_t n, void *buf, T &&val)
T time_since_epoch(T... args)
Defines the fields and their attributes within a STObject.
Buffer signDigest(PublicKey const &pk, SecretKey const &sk, uint256 const &digest)
Generate a signature for a message digest.
Blob getSerialized() const
void setSeen(NetClock::time_point s)
NetClock::time_point getSignTime() const
NetClock::time_point seenTime_
NetClock::time_point getSeenTime() const
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
bool setFlag(std::uint32_t)
uint256 getSigningHash() const
const SField sfValidation
PublicKey getSignerPublic() const
constexpr std::uint32_t vfFullValidation
STValidation(NetClock::time_point signTime, PublicKey const &pk, SecretKey const &sk, NodeID const &nodeID, F &&f)
Construct, sign and trust a new STValidation issued by this node.
virtual 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.