Changeset View
Changeset View
Standalone View
Standalone View
src/avalanche/test/util.cpp
Show All 16 Lines | |||||
namespace avalanche { | namespace avalanche { | ||||
ProofRef buildRandomProof(uint32_t score, const CKey &masterKey) { | ProofRef buildRandomProof(uint32_t score, const CKey &masterKey) { | ||||
auto key = CKey::MakeCompressedKey(); | auto key = CKey::MakeCompressedKey(); | ||||
const COutPoint o(TxId(GetRandHash()), 0); | const COutPoint o(TxId(GetRandHash()), 0); | ||||
const Amount v = (int64_t(score) * COIN) / 100; | const Amount v = (int64_t(score) * COIN) / 100; | ||||
const int height = 1234; | const int height = 100; | ||||
const bool is_coinbase = false; | const bool is_coinbase = false; | ||||
{ | { | ||||
CScript script = GetScriptForDestination(PKHash(key.GetPubKey())); | CScript script = GetScriptForDestination(PKHash(key.GetPubKey())); | ||||
LOCK(cs_main); | LOCK(cs_main); | ||||
CCoinsViewCache &coins = ::ChainstateActive().CoinsTip(); | CCoinsViewCache &coins = ::ChainstateActive().CoinsTip(); | ||||
coins.AddCoin(o, Coin(CTxOut(v, script), height, is_coinbase), false); | coins.AddCoin(o, Coin(CTxOut(v, script), height, is_coinbase), false); | ||||
▲ Show 20 Lines • Show All 90 Lines • Show Last 20 Lines |