6#ifndef ALT_INTEGRATION_INCLUDE_VERIBLOCK_BLOCKCHAIN_VBK_CHAIN_PARAMS_HPP_
7#define ALT_INTEGRATION_INCLUDE_VERIBLOCK_BLOCKCHAIN_VBK_CHAIN_PARAMS_HPP_
10#include <veriblock/pop/entities/vbkblock.hpp>
11#include <veriblock/pop/serde.hpp>
12#include <veriblock/pop/uint.hpp>
21 virtual int getProgPowForkHeight()
const = 0;
22 virtual uint32_t getProgPowStartTimeEpoch()
const noexcept = 0;
23 virtual bool isProgPowStartTimeEpochEnabled()
const noexcept {
return true; }
24 virtual const char* networkName()
const = 0;
25 virtual uint256 getMinimumDifficulty()
const = 0;
26 virtual VbkNetworkType getTransactionMagicByte()
const noexcept = 0;
27 virtual bool getPowNoRetargeting()
const noexcept = 0;
28 virtual uint32_t getRetargetPeriod()
const noexcept = 0;
29 virtual uint32_t getTargetBlockTime()
const noexcept = 0;
30 virtual uint32_t numBlocksForBootstrap()
const noexcept = 0;
31 virtual uint32_t maxFutureBlockTime()
const noexcept {
32 return mMaxFutureBlockTime;
40 virtual int32_t getMaxReorgBlocks() const noexcept {
return mMaxReorgBlocks; }
41 virtual uint32_t getKeystoneInterval() const noexcept {
return 20; }
43 virtual uint32_t getFinalityDelay() const noexcept {
return 11; }
47 return mOldBlocksWindow;
50 virtual const std::vector<uint32_t>& getForkResolutionLookUpTable()
52 return forkResolutionLookUpTable_;
55 virtual int32_t getEndorsementSettlementInterval() const noexcept {
56 return mEndorsementSettlementInterval;
64 VBK_ASSERT(mPreserveBlocksBehindFinal >= mEndorsementSettlementInterval);
65 return mPreserveBlocksBehindFinal;
70 uint32_t mOldBlocksWindow = 12000;
72 uint32_t mEndorsementSettlementInterval = 400;
73 uint32_t mPreserveBlocksBehindFinal = mEndorsementSettlementInterval;
77 uint32_t mMaxFutureBlockTime = 5 * 60;
78 std::vector<uint32_t> forkResolutionLookUpTable_{
79 100, 100, 95, 89, 80, 69, 56, 40, 21};
89 int getProgPowForkHeight()
const override {
return 1512000; }
90 virtual uint32_t getProgPowStartTimeEpoch()
const noexcept override {
94 const char* networkName()
const override {
return "main"; }
96 uint32_t numBlocksForBootstrap()
const noexcept override {
97 return getRetargetPeriod();
101 uint256 getMinimumDifficulty()
const override {
104 VbkNetworkType getTransactionMagicByte()
const noexcept override {
110 bool getPowNoRetargeting()
const noexcept override {
return false; }
114 uint32_t getRetargetPeriod() const noexcept
override {
return 100; }
116 uint32_t getTargetBlockTime() const noexcept
override {
return 30; }
126 int getProgPowForkHeight()
const override {
return 872000; }
127 uint32_t getProgPowStartTimeEpoch()
const noexcept override {
131 const char* networkName()
const override {
return "test"; }
133 uint32_t numBlocksForBootstrap()
const noexcept override {
134 return getRetargetPeriod();
138 uint256 getMinimumDifficulty()
const override {
142 VbkNetworkType getTransactionMagicByte()
const noexcept override {
148 bool getPowNoRetargeting()
const noexcept override {
return false; }
152 uint32_t getRetargetPeriod() const noexcept
override {
return 100; }
154 uint32_t getTargetBlockTime() const noexcept
override {
return 30; }
167 int getProgPowForkHeight()
const override {
return 0; }
168 uint32_t getProgPowStartTimeEpoch()
const noexcept override {
172 bool isProgPowStartTimeEpochEnabled()
const noexcept override {
176 const char* networkName()
const override {
return "regtest"; }
178 uint32_t numBlocksForBootstrap()
const noexcept override {
return 0; }
181 uint256 getMinimumDifficulty()
const override {
182 return uint256::fromHex(
"1");
184 VbkNetworkType getTransactionMagicByte()
const noexcept override {
192 bool getPowNoRetargeting() const noexcept
override {
return true; }
194 uint32_t getRetargetPeriod() const noexcept
override {
return 100; }
196 uint32_t getTargetBlockTime() const noexcept
override {
return 30; }
static ArithUint256 fromHex(const std::string &hex)
static const int32_t VBK_MAX_REORG_BLOCKS_MIN_VALUE
minimum number of blocks in VBK tree
bool EnableTimeAdjustment() const noexcept override
In miner it is hard to simulate correct timestamps, so this flag disables Time Adjustment Algorithm i...
bool EnableTimeAdjustment() const noexcept override
In miner it is hard to simulate correct timestamps, so this flag disables Time Adjustment Algorithm i...
bool EnableTimeAdjustment() const noexcept override
In miner it is hard to simulate correct timestamps, so this flag disables Time Adjustment Algorithm i...
VeriBlock chain parameters.
uint32_t preserveBlocksBehindFinal() const noexcept
when finalizeBlockImpl is called, this many blocks behind final block will be preserved in RAM.
virtual int32_t getOldBlocksWindow() const noexcept
all blocks further than this number of blocks are considered "old"
virtual bool EnableTimeAdjustment() const noexcept=0
In miner it is hard to simulate correct timestamps, so this flag disables Time Adjustment Algorithm i...
works as optional<uint8_t>
bool hasValue
if hasValue == false, it is mainnet
uint8_t value
otherwise, use value for network ID