Bitcoin ABC 0.30.7
P2P Digital Currency
proofbuilder.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_PROOFBUILDER_H
6#define BITCOIN_AVALANCHE_PROOFBUILDER_H
7
8#include <avalanche/proof.h>
9#include <key.h>
10
11#include <cstdio>
12
13namespace avalanche {
14
15struct TestProofBuilder;
16
18 uint64_t sequence;
22
24 bool operator()(const SignedStake &lhs, const SignedStake &rhs) const {
25 return lhs.getStake().getId() < rhs.getStake().getId();
26 }
27 };
28 std::set<SignedStake, SignedStakeComparator> stakes;
29
30public:
31 ProofBuilder(uint64_t sequence_, int64_t expirationTime_, CKey masterKey_,
32 const CScript &payoutScriptPubKey_)
33 : sequence(sequence_), expirationTime(expirationTime_),
34 masterKey(std::move(masterKey_)),
35 payoutScriptPubKey(payoutScriptPubKey_) {}
36
37 [[nodiscard]] bool addUTXO(COutPoint utxo, Amount amount, uint32_t height,
38 bool is_coinbase, CKey key);
39
41
42private:
44 ProofId getProofId() const;
45
46 friend struct TestProofBuilder;
47};
48
49} // namespace avalanche
50
51#endif // BITCOIN_AVALANCHE_PROOFBUILDER_H
An encapsulated secp256k1 private key.
Definition: key.h:28
An outpoint - a combination of a transaction hash and an index n into its vout.
Definition: transaction.h:20
Serialized script, used inside transaction inputs and outputs.
Definition: script.h:424
bool addUTXO(COutPoint utxo, Amount amount, uint32_t height, bool is_coinbase, CKey key)
std::set< SignedStake, SignedStakeComparator > stakes
Definition: proofbuilder.h:28
ProofId getProofId() const
LimitedProofId getLimitedProofId() const
ProofBuilder(uint64_t sequence_, int64_t expirationTime_, CKey masterKey_, const CScript &payoutScriptPubKey_)
Definition: proofbuilder.h:31
const Stake & getStake() const
Definition: proof.h:96
const StakeId & getId() const
Definition: proof.h:82
Implement std::hash so RCUPtr can be used as a key for maps or sets.
Definition: rcu.h:259
Definition: amount.h:19
bool operator()(const SignedStake &lhs, const SignedStake &rhs) const
Definition: proofbuilder.h:24