chainparams: add allowed assumeutxo values

Values for mainnet and testnet will be specified in a follow-up PR that can be
scrutinized accordingly. This structure is required for use in snapshot activation
logic.
This commit is contained in:
James O'Beirne
2019-04-25 11:09:29 -04:00
committed by James O'Beirne
parent e9c037ba64
commit 7a6c46b37e
6 changed files with 110 additions and 1 deletions

View File

@@ -30,6 +30,26 @@ struct CCheckpointData {
}
};
/**
* Holds configuration for use during UTXO snapshot load and validation. The contents
* here are security critical, since they dictate which UTXO snapshots are recognized
* as valid.
*/
struct AssumeutxoData {
//! The expected hash of the deserialized UTXO set.
const uint256 hash_serialized;
//! Used to populate the nChainTx value, which is used during BlockManager::LoadBlockIndex().
//!
//! We need to hardcode the value here because this is computed cumulatively using block data,
//! which we do not necessarily have at the time of snapshot load.
const unsigned int nChainTx;
};
std::ostream& operator<<(std::ostream& o, const AssumeutxoData& aud);
using MapAssumeutxo = std::map<int, const AssumeutxoData>;
/**
* Holds various statistics on transactions within a chain. Used to estimate
* verification progress during chain sync.
@@ -90,6 +110,11 @@ public:
const std::string& Bech32HRP() const { return bech32_hrp; }
const std::vector<SeedSpec6>& FixedSeeds() const { return vFixedSeeds; }
const CCheckpointData& Checkpoints() const { return checkpointData; }
//! Get allowed assumeutxo configuration.
//! @see ChainstateManager
const MapAssumeutxo& Assumeutxo() const { return m_assumeutxo_data; }
const ChainTxData& TxData() const { return chainTxData; }
protected:
CChainParams() {}
@@ -111,6 +136,7 @@ protected:
bool m_is_test_chain;
bool m_is_mockable_chain;
CCheckpointData checkpointData;
MapAssumeutxo m_assumeutxo_data;
ChainTxData chainTxData;
};