Changeset View
Changeset View
Standalone View
Standalone View
src/config.h
// Copyright (c) 2017 Amaury SÉCHET | // Copyright (c) 2017 Amaury SÉCHET | ||||
// Distributed under the MIT software license, see the accompanying | // Distributed under the MIT software license, see the accompanying | ||||
// file COPYING or http://www.opensource.org/licenses/mit-license.php. | // file COPYING or http://www.opensource.org/licenses/mit-license.php. | ||||
#ifndef BITCOIN_CONFIG_H | #ifndef BITCOIN_CONFIG_H | ||||
#define BITCOIN_CONFIG_H | #define BITCOIN_CONFIG_H | ||||
#include "chain.h" | |||||
#include <boost/noncopyable.hpp> | #include <boost/noncopyable.hpp> | ||||
#include <cstdint> | #include <cstdint> | ||||
class CChainParams; | class CChainParams; | ||||
class Config : public boost::noncopyable { | class Config : public boost::noncopyable { | ||||
public: | public: | ||||
virtual bool SetMaxBlockSize(uint64_t maxBlockSize) = 0; | virtual bool SetMaxBlockSize(uint64_t maxBlockSize) = 0; | ||||
virtual uint64_t GetMaxBlockSize() const = 0; | virtual uint64_t GetMaxBlockSize() const = 0; | ||||
virtual bool SetUAHFStartTime(int64_t uahfStartTime) = 0; | virtual bool SetUAHFStartTime(int64_t uahfStartTime) = 0; | ||||
virtual int64_t GetUAHFStartTime() const = 0; | virtual int64_t GetUAHFStartTime() const = 0; | ||||
virtual const CChainParams &GetChainParams() const = 0; | virtual const CChainParams &GetChainParams() const = 0; | ||||
virtual bool | |||||
CheckBlockWithCurrentConsensus(const CBlockIndex *blockIndex) const = 0; | |||||
virtual CBlockIndex *SelectBestChain( | |||||
const std::pair<CBlockIndex *, CBlockIndex *> ¬YetValidChain, | |||||
const std::pair<CBlockIndex *, CBlockIndex *> &validChain) const = 0; | |||||
}; | }; | ||||
class GlobalConfig final : public Config { | class GlobalConfig final : public Config { | ||||
public: | public: | ||||
GlobalConfig(); | |||||
bool SetMaxBlockSize(uint64_t maxBlockSize); | bool SetMaxBlockSize(uint64_t maxBlockSize); | ||||
uint64_t GetMaxBlockSize() const; | uint64_t GetMaxBlockSize() const; | ||||
bool SetUAHFStartTime(int64_t uahfStartTime); | bool SetUAHFStartTime(int64_t uahfStartTime); | ||||
int64_t GetUAHFStartTime() const; | int64_t GetUAHFStartTime() const; | ||||
const CChainParams &GetChainParams() const; | const CChainParams &GetChainParams() const; | ||||
// EC Functions | |||||
bool CheckBlockWithCurrentConsensus(const CBlockIndex *blockIndex) const; | |||||
CBlockIndex *SelectBestChain( | |||||
const std::pair<CBlockIndex *, CBlockIndex *> ¬YetValidChain, | |||||
const std::pair<CBlockIndex *, CBlockIndex *> &validChain) const; | |||||
}; | }; | ||||
// Temporary woraround. | // Temporary woraround. | ||||
const Config &GetConfig(); | const Config &GetConfig(); | ||||
#endif | #endif |