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>
49 return "STValidation";
68 template <
class LookupNodeID>
71 LookupNodeID&& lookupNodeID,
79 JLOG(
debugLog().error()) <<
"Invalid public key in validation: "
81 Throw<std::runtime_error>(
"Invalid public key in validation");
84 if (checkSignature && !
isValid())
86 JLOG(
debugLog().error()) <<
"Invalid signature in validation: "
88 Throw<std::runtime_error>(
"Invalid signature in validation");
103 template <
typename F>
117 "We can only use secp256k1 keys for signing validations");
135 "Required field '" + e.sField().getName() +
136 "' missing from validation.");
149 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.
static char const * getCountedObjectName()
const SF_Blob sfSigningPubKey(access, STI_VL, 3, "SigningPubKey")
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
const SF_Blob sfSignature(access, STI_VL, 6, "Signature", SField::sMD_Default, SField::notSigning)
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.
const SF_U32 sfSigningTime(access, STI_UINT32, 9, "SigningTime")
Blob getSerialized() const
void setSeen(NetClock::time_point s)
const SField sfValidation(access, STI_VALIDATION, 257, "Validation")
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
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)
STValidation(SerialIter &sit, LookupNodeID &&lookupNodeID, bool checkSignature)
Construct a STValidation from a peer.