Changeset View
Changeset View
Standalone View
Standalone View
src/avalanche/proof.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_PROOF_H | #ifndef BITCOIN_AVALANCHE_PROOF_H | ||||
#define BITCOIN_AVALANCHE_PROOF_H | #define BITCOIN_AVALANCHE_PROOF_H | ||||
#include <amount.h> | #include <amount.h> | ||||
#include <avalanche/proofid.h> | #include <avalanche/proofid.h> | ||||
#include <key.h> | |||||
#include <primitives/transaction.h> | #include <primitives/transaction.h> | ||||
#include <pubkey.h> | #include <pubkey.h> | ||||
#include <serialize.h> | #include <serialize.h> | ||||
#include <array> | #include <array> | ||||
#include <cstdint> | #include <cstdint> | ||||
#include <vector> | #include <vector> | ||||
Show All 27 Lines | public: | ||||
bool isCoinbase() const { return height & 1; } | bool isCoinbase() const { return height & 1; } | ||||
const CPubKey &getPubkey() const { return pubkey; } | const CPubKey &getPubkey() const { return pubkey; } | ||||
uint256 getHash(const ProofId &proofid) const; | uint256 getHash(const ProofId &proofid) const; | ||||
}; | }; | ||||
class SignedStake { | class SignedStake { | ||||
Stake stake; | Stake stake; | ||||
std::array<uint8_t, 64> sig; | SchnorrSig sig; | ||||
public: | public: | ||||
explicit SignedStake() = default; | explicit SignedStake() = default; | ||||
SignedStake(Stake stake_, std::array<uint8_t, 64> sig_) | SignedStake(Stake stake_, SchnorrSig sig_) | ||||
: stake(std::move(stake_)), sig(std::move(sig_)) {} | : stake(std::move(stake_)), sig(std::move(sig_)) {} | ||||
SERIALIZE_METHODS(SignedStake, obj) { READWRITE(obj.stake, obj.sig); } | SERIALIZE_METHODS(SignedStake, obj) { READWRITE(obj.stake, obj.sig); } | ||||
const Stake &getStake() const { return stake; } | const Stake &getStake() const { return stake; } | ||||
const std::array<uint8_t, 64> &getSignature() const { return sig; } | const SchnorrSig &getSignature() const { return sig; } | ||||
bool verify(const ProofId &proofid) const; | bool verify(const ProofId &proofid) const; | ||||
}; | }; | ||||
class Proof { | class Proof { | ||||
uint64_t sequence; | uint64_t sequence; | ||||
int64_t expirationTime; | int64_t expirationTime; | ||||
CPubKey master; | CPubKey master; | ||||
Show All 33 Lines |