Bitcoin ABC 0.30.5
P2P Digital Currency
proofid.h
Go to the documentation of this file.
1// Copyright (c) 2020 The Bitcoin developers
2// Distributed under the MIT software license, see the accompanying
3// file COPYING or http://www.opensource.org/licenses/mit-license.php.
4
5#ifndef BITCOIN_AVALANCHE_PROOFID_H
6#define BITCOIN_AVALANCHE_PROOFID_H
7
8#include <uint256.h>
9#include <util/hasher.h>
10
11#include <string>
12
13class CPubKey;
14
15namespace avalanche {
16
17struct ProofId : public uint256 {
18 explicit ProofId() : uint256() {}
19 explicit ProofId(const uint256 &b) : uint256(b) {}
20
21 static ProofId fromHex(const std::string &str) {
22 ProofId r;
23 r.SetHex(str);
24 return r;
25 }
26};
27
28struct LimitedProofId : public uint256 {
29 explicit LimitedProofId() : uint256() {}
30 explicit LimitedProofId(const uint256 &b) : uint256(b) {}
31
32 static LimitedProofId fromHex(const std::string &str) {
34 r.SetHex(str);
35 return r;
36 }
37
38 ProofId computeProofId(const CPubKey &proofMaster) const;
39};
40
42public:
44 size_t operator()(const ProofId &proofid) const { return hash(proofid); }
45};
46
47} // namespace avalanche
48
49#endif // BITCOIN_AVALANCHE_PROOFID_H
An encapsulated public key.
Definition: pubkey.h:31
size_t hash(const uint256 &h) const
Definition: hasher.h:23
size_t operator()(const ProofId &proofid) const
Definition: proofid.h:44
void SetHex(const char *psz)
Definition: uint256.cpp:24
256-bit opaque blob.
Definition: uint256.h:129
ProofId computeProofId(const CPubKey &proofMaster) const
Definition: proofid.cpp:12
LimitedProofId(const uint256 &b)
Definition: proofid.h:30
static LimitedProofId fromHex(const std::string &str)
Definition: proofid.h:32
static ProofId fromHex(const std::string &str)
Definition: proofid.h:21
ProofId(const uint256 &b)
Definition: proofid.h:19