12#include <validation.h>
14#include <boost/test/unit_test.hpp>
21 int height,
const CKey &masterKey) {
26 const bool is_coinbase =
false;
36 ProofBuilder pb(0, std::numeric_limits<uint32_t>::max(), masterKey, script);
37 BOOST_CHECK(
pb.addUTXO(
o, v, height, is_coinbase, std::move(key)));
54 ss <<
pb.expirationTime;
55 ss <<
pb.payoutScriptPubKey;
58 for (
auto it =
pb.stakes.rbegin(); it !=
pb.stakes.rend(); it++) {
70 pb.masterKey.GetPubKey());
75 while (!
pb.stakes.empty()) {
78 auto handle =
pb.stakes.extract(std::prev(
pb.stakes.end()));
94 ss <<
pb.expirationTime;
95 ss <<
pb.payoutScriptPubKey;
98 for (
auto &s :
pb.stakes) {
111 pb.masterKey.GetPubKey());
116 while (!
pb.stakes.empty()) {
117 auto handle =
pb.stakes.extract(
pb.stakes.begin());
static constexpr Amount COIN
CCoinsView that adds a memory cache for transactions to another CCoinsView.
void AddCoin(const COutPoint &outpoint, Coin coin, bool possible_overwrite)
Add a coin.
An encapsulated secp256k1 private key.
static CKey MakeCompressedKey()
Produce a valid compressed key.
An outpoint - a combination of a transaction hash and an index n into its vout.
An encapsulated public key.
Serialized script, used inside transaction inputs and outputs.
An output of a transaction.
Chainstate stores and provides an API to update our local knowledge of the current best chain.
A writer stream (for serialization) that computes a 256-bit hash.
static RCUPtr make(Args &&...args)
Construct a new object that is owned by the pointer.
const std::vector< SignedStake > & getStakes() const
RecursiveMutex cs_main
Mutex to guard access to validation specific variables, such as reading or changing the chainstate.
std::array< uint8_t, CPubKey::SCHNORR_SIZE > SchnorrSig
a Schnorr signature
static constexpr Amount PROOF_DUST_THRESHOLD
Minimum amount per utxo.
ProofRef buildRandomProof(Chainstate &active_chainstate, uint32_t score, int height, const CKey &masterKey)
bool hasDustStake(const ProofRef &proof)
#define BOOST_CHECK(expr)
uint256 GetRandHash() noexcept
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...
void WriteCompactSize(CSizeComputer &os, uint64_t nSize)
CScript GetScriptForDestination(const CTxDestination &dest)
Generate a Bitcoin scriptPubKey for the given CTxDestination.
A TxId is the identifier of a transaction.
static ProofRef buildWithReversedOrderStakes(ProofBuilder &pb)
static ProofRef buildDuplicatedStakes(ProofBuilder &pb)
static LimitedProofId getReverseOrderLimitedProofId(ProofBuilder &pb)
static LimitedProofId getDuplicatedStakeLimitedProofId(ProofBuilder &pb)