6#ifndef ALT_INTEGRATION_INCLUDE_VERIBLOCK_BLOCKCHAIN_BTC_CHAIN_PARAMS_HPP_
7#define ALT_INTEGRATION_INCLUDE_VERIBLOCK_BLOCKCHAIN_BTC_CHAIN_PARAMS_HPP_
9#include <veriblock/pop/entities/btcblock.hpp>
10#include <veriblock/pop/serde.hpp>
11#include <veriblock/pop/strutil.hpp>
12#include <veriblock/pop/uint.hpp>
13#include <veriblock/pop/validation_state.hpp>
20 virtual uint256 getPowLimit()
const = 0;
21 virtual uint32_t getPowTargetTimespan()
const noexcept = 0;
22 virtual uint32_t getPowTargetSpacing()
const noexcept = 0;
23 virtual bool getAllowMinDifficultyBlocks()
const noexcept = 0;
24 virtual bool getPowNoRetargeting()
const noexcept = 0;
26 virtual bool EnableTimeAdjustment()
const noexcept = 0;
27 uint32_t getDifficultyAdjustmentInterval()
const noexcept {
28 return getPowTargetTimespan() / getPowTargetSpacing();
32 virtual const
char* networkName() const noexcept = 0;
33 virtual uint32_t maxFutureBlockTime() const noexcept {
34 return mMaxFutureBlockTime;
39 VBK_ASSERT(
static_cast<uint32_t
>(mMaxReorgBlocks) >=
40 getDifficultyAdjustmentInterval());
41 return mMaxReorgBlocks;
51 uint32_t mOldBlocksWindow = 1000;
55 uint32_t mMaxFutureBlockTime = 2 * 60 * 60;
67 bool EnableTimeAdjustment()
const noexcept override {
return true; }
69 const char* networkName()
const noexcept override {
return "main"; }
72 return getDifficultyAdjustmentInterval();
75 uint256 getPowLimit()
const override {
76 return uint256::fromHex(
77 "ffffffffffffffffffffffffffffffffffffffffffffffffffffffff00000000");
80 uint32_t getPowTargetTimespan() const noexcept
override {
81 return 14 * 24 * 60 * 60;
83 uint32_t getPowTargetSpacing() const noexcept
override {
return 10 * 60; }
84 bool getAllowMinDifficultyBlocks() const noexcept
override {
return false; }
85 bool getPowNoRetargeting() const noexcept
override {
return false; }
113 bool EnableTimeAdjustment()
const noexcept override {
return true; }
115 const char* networkName()
const noexcept override {
return "test"; }
118 return getDifficultyAdjustmentInterval();
121 uint256 getPowLimit()
const override {
122 return uint256::fromHex(
123 "ffffffffffffffffffffffffffffffffffffffffffffffffffffffff00000000");
126 uint32_t getPowTargetTimespan() const noexcept
override {
127 return 14 * 24 * 60 * 60;
129 uint32_t getPowTargetSpacing() const noexcept
override {
return 10 * 60; }
130 bool getAllowMinDifficultyBlocks() const noexcept
override {
return true; }
131 bool getPowNoRetargeting() const noexcept
override {
return false; }
162 const char* networkName() const noexcept
override {
return "regtest"; }
166 uint256 getPowLimit()
const override {
167 return uint256::fromHex(
168 "ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff7f");
171 uint32_t getPowTargetTimespan() const noexcept
override {
172 return 14 * 24 * 60 * 60;
174 uint32_t getPowTargetSpacing() const noexcept
override {
return 10 * 60; }
175 bool getAllowMinDifficultyBlocks() const noexcept
override {
return true; }
176 bool getPowNoRetargeting() const noexcept
override {
return true; }
static const int32_t BTC_MAX_REORG_BLOCKS_MIN_VALUE
minimum number of blocks in BTC tree
mainnet network params in Bitcoin chain.
uint32_t numBlocksForBootstrap() const noexcept override
minimum number of BTC blocks needed to bootstrap chain
regtest network params in Bitcoin chain.
bool EnableTimeAdjustment() const noexcept override
time adjustment is disabled in regtest mode
uint32_t numBlocksForBootstrap() const noexcept override
minimum number of BTC blocks needed to bootstrap chain
testnet3 network params in Bitcoin chain.
uint32_t numBlocksForBootstrap() const noexcept override
minimum number of BTC blocks needed to bootstrap chain
base class for BTC params
int32_t getOldBlocksWindow() const noexcept
all blocks further than this number of blocks are considered "old"
virtual uint32_t numBlocksForBootstrap() const noexcept=0
minimum number of BTC blocks needed to bootstrap chain
uint32_t preserveBlocksBehindFinal() const noexcept
when finalizeBlockImpl is called, this many blocks behind final block will be preserved in RAM.
int32_t getMaxReorgBlocks() const noexcept
by default we store this many last BTC blocks in RAM