veriblock-pop-cpp
C++11 Libraries for leveraging VeriBlock Proof-Of-Proof blockchain technology.
altintegration::AltChainParamsRegTest Struct Reference

Detailed Description

Definition at line 280 of file alt_chain_params.hpp.

+ Inheritance diagram for altintegration::AltChainParamsRegTest:
+ Collaboration diagram for altintegration::AltChainParamsRegTest:

Public Member Functions

 AltChainParamsRegTest (int id=0)
 
AltBlock getBootstrapBlock () const noexcept override
 "genesis" block for POP mining. More...
 
int64_t getIdentifier () const noexcept override
 unique POP ID for the chain; identifies altchain in VBK More...
 
std::vector< uint8_t > getHash (const std::vector< uint8_t > &bytes) const noexcept override
 Calculate hash from block header. More...
 
bool checkBlockHeader (const std::vector< uint8_t > &bytes, const std::vector< uint8_t > &, ValidationState &state) const noexcept override
 Returns true if input bytes: More...
 
- Public Member Functions inherited from altintegration::AltChainParams
size_t maxWorkerQueueSize () const noexcept
 
uint32_t getKeystoneInterval () const noexcept
 number of blocks in single keystone interval. More...
 
uint32_t getFinalityDelay () const noexcept
 number of blocks in VBK used for finalization More...
 
const std::vector< uint32_t > & getForkResolutionLookUpTable () const noexcept
 pop score lookup table for fork resolution More...
 
uint32_t getEndorsementSettlementInterval () const noexcept
 Validity window for ATVs. More...
 
const PopPayoutsParamsgetPayoutParams () const noexcept
 getter for reward parameters More...
 
size_t getMaxVbkBlocksInAltBlock () const noexcept
 total maximum number of VBK blocks per 1 ALT block More...
 
size_t getMaxVTBsInAltBlock () const noexcept
 total maximum number of VTBs per 1 ALT block More...
 
size_t getMaxATVsInAltBlock () const noexcept
 total maximum number of ATVs per 1 ALT block More...
 
size_t getMaxPopDataSize () const noexcept
 maximum size (in bytes) of single PopData per single ALT block More...
 
uint32_t maxAltchainFutureBlockTime () const noexcept
 Maximum future block time for altchain blocks. More...
 
int32_t getMaxReorgBlocks () const noexcept
 Max number of blocks that can be reorganized in altchain. More...
 
uint32_t preserveBlocksBehindFinal () const noexcept
 when finalizeBlockImpl is called, this many blocks behind final block will be preserved in RAM. More...
 
virtual int64_t getIdentifier () const noexcept=0
 unique POP ID for the chain; identifies altchain in VBK More...
 
virtual AltBlock getBootstrapBlock () const noexcept=0
 "genesis" block for POP mining. More...
 
virtual std::vector< uint8_t > getHash (const std::vector< uint8_t > &bytes) const noexcept=0
 Calculate hash from block header. More...
 
virtual bool checkBlockHeader (const std::vector< uint8_t > &bytes, const std::vector< uint8_t > &root, ValidationState &state) const noexcept=0
 Returns true if input bytes: More...
 

Public Attributes

int64_t id = 0
 
- Public Attributes inherited from altintegration::AltChainParams
std::shared_ptr< PopPayoutsParamsmPopPayoutsParams
 
int32_t mMaxReorgBlocks = ALT_MAX_REORG_BLOCKS_MIN_VALUE
 
uint32_t mMaxAltchainFutureBlockTime = 10 * 60
 
uint32_t mKeystoneInterval = 5
 
uint32_t mFinalityDelay = 100
 
uint32_t mEndorsementSettlementInterval = 50
 
uint32_t mPreserveBlocksBehindFinal = mEndorsementSettlementInterval
 
uint32_t mMaxPopDataSize = MAX_POPDATA_SIZE
 
size_t mMaxVbkBlocksInAltBlock = 200
 
size_t mMaxVTBsInAltBlock = 200
 
size_t mMaxATVsInAltBlock = 1000
 
std::vector< uint32_t > mForkResolutionLookUpTable
 

Constructor & Destructor Documentation

◆ AltChainParamsRegTest()

altintegration::AltChainParamsRegTest::AltChainParamsRegTest ( int  id = 0)
inline

Definition at line 281 of file alt_chain_params.hpp.

281: id(id) {}

Member Function Documentation

◆ checkBlockHeader()

bool altintegration::AltChainParamsRegTest::checkBlockHeader ( const std::vector< uint8_t > &  bytes,
const std::vector< uint8_t > &  root,
ValidationState state 
) const
inlineoverridevirtualnoexcept
  • can be deserialized to a header
  • statelessly valid (time, POW, version... etc)
  • top level merkle root is equal to 'root'
    Parameters
    [in]bytes
    [in]roottop level merkle root to validate
    [out]statevalidation state
    Returns
    false if any of checks fail
    Warning
    SHOULD NOT THROW

Implements altintegration::AltChainParams.

Definition at line 300 of file alt_chain_params.hpp.

302 {
303 AltBlock block;
304 return DeserializeFromRaw<AltBlock>(bytes, block, state);
305 }

◆ getBootstrapBlock()

AltBlock altintegration::AltChainParamsRegTest::getBootstrapBlock ( ) const
inlineoverridevirtualnoexcept

This is first block that can be endorsed by POP miners. Can start at genesis block, or at any part of the active chain. This block is immediately finalized, so chain CAN NOT be reorganized past this block.

Implements altintegration::AltChainParams.

Definition at line 284 of file alt_chain_params.hpp.

284 {
285 AltBlock b;
286 b.hash = std::vector<uint8_t>(SHA256_HASH_SIZE, 1);
287 b.previousBlock = std::vector<uint8_t>(SHA256_HASH_SIZE, 0);
288 b.height = 0;
289 b.timestamp = 0;
290 return b;
291 }
constexpr const auto SHA256_HASH_SIZE
sha256 hash size
Definition: consts.hpp:39

◆ getHash()

std::vector< uint8_t > altintegration::AltChainParamsRegTest::getHash ( const std::vector< uint8_t > &  bytes) const
inlineoverridevirtualnoexcept
Parameters
bytesserialized block header
Returns
hash
Note
if input data is not valid block header, still calculate hash from input data.
Warning
SHOULD NOT THROW

Implements altintegration::AltChainParams.

Definition at line 295 of file alt_chain_params.hpp.

296 {
297 return AssertDeserializeFromRaw<AltBlock>(bytes).getHash();
298 }

◆ getIdentifier()

int64_t altintegration::AltChainParamsRegTest::getIdentifier ( ) const
inlineoverridevirtualnoexcept

Implements altintegration::AltChainParams.

Definition at line 293 of file alt_chain_params.hpp.

293{ return id; }

Member Data Documentation

◆ id

int64_t altintegration::AltChainParamsRegTest::id = 0

Definition at line 307 of file alt_chain_params.hpp.


The documentation for this struct was generated from the following file: