Changeset View
Changeset View
Standalone View
Standalone View
src/avalanche/delegation.h
// Copyright (c) 2020 The Bitcoin developers | // Copyright (c) 2020 The Bitcoin developers | ||||
// Distributed under the MIT software license, see the accompanying | // Distributed under the MIT software license, see the accompanying | ||||
// file COPYING or http://www.opensource.org/licenses/mit-license.php. | // file COPYING or http://www.opensource.org/licenses/mit-license.php. | ||||
#ifndef BITCOIN_AVALANCHE_DELEGATION_H | #ifndef BITCOIN_AVALANCHE_DELEGATION_H | ||||
#define BITCOIN_AVALANCHE_DELEGATION_H | #define BITCOIN_AVALANCHE_DELEGATION_H | ||||
#include <avalanche/delegationid.h> | #include <avalanche/delegationid.h> | ||||
#include <avalanche/proofid.h> | #include <avalanche/proofid.h> | ||||
#include <key.h> | #include <key.h> | ||||
#include <pubkey.h> | #include <pubkey.h> | ||||
#include <serialize.h> | #include <serialize.h> | ||||
#include <vector> | #include <vector> | ||||
struct bilingual_str; | |||||
namespace avalanche { | namespace avalanche { | ||||
class DelegationState; | class DelegationState; | ||||
class Proof; | class Proof; | ||||
class Delegation { | class Delegation { | ||||
LimitedProofId limitedProofid; | LimitedProofId limitedProofid; | ||||
CPubKey proofMaster; | CPubKey proofMaster; | ||||
Show All 15 Lines | Delegation(const LimitedProofId &limitedProofid_, | ||||
const CPubKey &proofMaster_, const DelegationId &dgid_, | const CPubKey &proofMaster_, const DelegationId &dgid_, | ||||
std::vector<Level> levels_) | std::vector<Level> levels_) | ||||
: limitedProofid(limitedProofid_), proofMaster(proofMaster_), | : limitedProofid(limitedProofid_), proofMaster(proofMaster_), | ||||
dgid(dgid_), levels(std::move(levels_)) {} | dgid(dgid_), levels(std::move(levels_)) {} | ||||
public: | public: | ||||
explicit Delegation() {} | explicit Delegation() {} | ||||
static bool FromHex(Delegation &dg, const std::string &dgHex, | |||||
bilingual_str &errorOut); | |||||
const DelegationId &getId() const { return dgid; } | const DelegationId &getId() const { return dgid; } | ||||
const LimitedProofId &getLimitedProofId() const { return limitedProofid; } | const LimitedProofId &getLimitedProofId() const { return limitedProofid; } | ||||
const CPubKey &getProofMaster() const { return proofMaster; } | const CPubKey &getProofMaster() const { return proofMaster; } | ||||
ProofId getProofId() const; | ProofId getProofId() const; | ||||
SERIALIZE_METHODS(Delegation, obj) { | SERIALIZE_METHODS(Delegation, obj) { | ||||
READWRITE(obj.limitedProofid, obj.proofMaster, obj.levels); | READWRITE(obj.limitedProofid, obj.proofMaster, obj.levels); | ||||
Show All 9 Lines |