Bitcoin ABC  0.26.3
P2P Digital Currency
util.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_TEST_UTIL_H
6 #define BITCOIN_AVALANCHE_TEST_UTIL_H
7 
8 #include <avalanche/proof.h>
10 #include <key.h>
11 #include <script/script.h>
12 
13 #include <vector>
14 
15 namespace avalanche {
16 
17 constexpr uint32_t MIN_VALID_PROOF_SCORE = 100 * PROOF_DUST_THRESHOLD / COIN;
18 
20  CScript() << OP_DUP << OP_HASH160 << std::vector<uint8_t>(20, 0)
22 
23 ProofRef buildRandomProof(Chainstate &active_chainstate, uint32_t score,
24  int height = 100,
25  const CKey &masterKey = CKey::MakeCompressedKey());
26 
27 bool hasDustStake(const ProofRef &proof);
28 
34 };
35 
36 } // namespace avalanche
37 
38 #endif // BITCOIN_AVALANCHE_TEST_UTIL_H
static constexpr Amount COIN
Definition: amount.h:144
An encapsulated secp256k1 private key.
Definition: key.h:28
static CKey MakeCompressedKey()
Produce a valid compressed key.
Definition: key.cpp:466
Serialized script, used inside transaction inputs and outputs.
Definition: script.h:431
Chainstate stores and provides an API to update our local knowledge of the current best chain.
Definition: validation.h:630
static constexpr Amount PROOF_DUST_THRESHOLD
Minimum amount per utxo.
Definition: proof.h:40
const CScript UNSPENDABLE_ECREG_PAYOUT_SCRIPT
Definition: util.h:19
ProofRef buildRandomProof(Chainstate &active_chainstate, uint32_t score, int height, const CKey &masterKey)
Definition: util.cpp:20
constexpr uint32_t MIN_VALID_PROOF_SCORE
Definition: util.h:17
bool hasDustStake(const ProofRef &proof)
Definition: util.cpp:42
@ OP_CHECKSIG
Definition: script.h:163
@ OP_EQUALVERIFY
Definition: script.h:120
static ProofRef buildWithReversedOrderStakes(ProofBuilder &pb)
Definition: util.cpp:66
static ProofRef buildDuplicatedStakes(ProofBuilder &pb)
Definition: util.cpp:107
static LimitedProofId getReverseOrderLimitedProofId(ProofBuilder &pb)
Definition: util.cpp:52
static LimitedProofId getDuplicatedStakeLimitedProofId(ProofBuilder &pb)
Definition: util.cpp:92