19 errorOut =
_(
"Delegation must be an hexadecimal string.");
27 }
catch (std::exception &
e) {
35template <
typename L,
typename F>
37 for (
const auto &
l : levels) {
53 return reduceLevels(hash, levels, [](
const L &) {
return true; });
62 return levels.back().pubkey;
83 if (!
pauth->VerifySchnorr(hash,
l.sig)) {
84 return state.Invalid(DelegationResult::INVALID_SIGNATURE,
Double ended buffer combining vector and stream-like interfaces.
An encapsulated public key.
A writer stream (for serialization) that computes a 256-bit hash.
bool Invalid(Result result, const std::string &reject_reason="", const std::string &debug_message="")
ProofId getProofId() const
static bool FromHex(Delegation &dg, const std::string &dgHex, bilingual_str &errorOut)
bool verify(DelegationState &state, CPubKey &auth) const
std::vector< Level > levels
LimitedProofId limitedProofid
const CPubKey & getDelegatedPubkey() const
DelegationId computeDelegationId() const
constexpr size_t MAX_DELEGATION_LEVELS
The maximum number of delegation levels we are willing to verify.
static bool reduceLevels(uint256 &hash, const std::vector< L > &levels, F f)
T GetRand(T nMax=std::numeric_limits< T >::max()) noexcept
Generate a uniform random integer of type T in the range [0..nMax) nMax defaults to std::numeric_limi...
ProofId computeProofId(const CPubKey &proofMaster) const
bilingual_str _(const char *psz)
Translation function.
template std::vector< std::byte > ParseHex(std::string_view)
bool IsHex(std::string_view str)
Returns true if each character in str is a hex character, and has an even number of hex digits.
static const int PROTOCOL_VERSION
network protocol versioning