7 #include "validation.h"
28 if (nHeightChecksum != nullopt) {
34 LogPrintf(
"WARNING: accumulatorCache corrupt - missing (%d-%d), height=%d\n",
41 assert(cpHeight <= consensus.height_last_ZC_AccumCheckpoint && cpHeight > zc_activation);
44 if (!pindex)
return nullptr;
49 if (pindex->
nHeight > zc_activation) {
62 LogPrintf(
"%s: unable to initialize CLegacyZPivStake from non zc-spend\n", __func__);
77 LogPrintf(
"%s : spend is using the wrong SpendType (%d)\n", __func__, (
int)spend.
getSpendType());
93 const CBlockIndex* _pindexFrom = FindIndexFrom(_nChecksum, _denom, cpHeight);
94 if (_pindexFrom ==
nullptr) {
95 LogPrintf(
"%s : Failed to find the block index for zpiv stake origin\n", __func__);
int64_t CAmount
Amount in PIV (Can be negative)
arith_uint256 UintToArith256(const uint256 &a)
const CChainParams & Params()
Return the currently selected parameters.
arith_uint256 getuint256() const
The block chain is a tree shaped structure starting with the genesis block at the root,...
uint256 nAccumulatorCheckpoint
int nHeight
height of the entry in the chain. The genesis block has height 0
const Consensus::Params & GetConsensus() const
CDataStream GetUniqueness() const override
const CBlockIndex * GetIndexFrom() const override
libzerocoin::CoinDenomination denom
static CLegacyZPivStake * NewZPivStake(const CTxIn &txin, int nHeight)
CAmount GetValue() const override
CLegacyZPivStake(const CBlockIndex *_pindexFrom, uint32_t _nChecksum, libzerocoin::CoinDenomination _denom, const uint256 &_hashSerial)
An input of a transaction.
bool IsZerocoinSpend() const
256-bit unsigned big integer.
The complete proof needed to spend a zerocoin.
const CBigNum & getCoinSerialNumber() const
CoinDenomination getDenomination() const
SpendType getSpendType() const
uint32_t getAccumulatorChecksum() const
uint256 Hash(const T1 pbegin, const T1 pend)
Compute the 256-bit hash of an object.
#define LogPrint(category,...)
libzerocoin::CoinSpend TxInToZerocoinSpend(const CTxIn &txin)
const std::vector< CoinDenomination > zerocoinDenomList
int64_t ZerocoinDenominationToInt(const CoinDenomination &denomination)
boost::optional< T > Optional
Substitute for C++17 std::optional.
int nActivationHeight
Height of the first block for which the new consensus rules will be active.
Parameters that influence chain consensus.
NetworkUpgrade vUpgrades[MAX_NETWORK_UPGRADES]
int height_last_ZC_AccumCheckpoint
bool NetworkUpgradeActive(int nHeight, Consensus::UpgradeIndex idx) const
Returns true if the given network upgrade is active as of the given block height.
CChain chainActive
The currently-connected chain of blocks (protected by cs_main).
std::unique_ptr< AccumulatorCache > accumulatorCache
In-memory cache for the zerocoin accumulators.
uint32_t ParseAccChecksum(uint256 nCheckpoint, const libzerocoin::CoinDenomination denom)