6#ifndef ALTINTEGRATION_ALTINTEGRATION_HPP
7#define ALTINTEGRATION_ALTINTEGRATION_HPP
11#include "alt-util.hpp"
12#include "blockchain/alt_block_tree.hpp"
13#include "bootstraps.hpp"
16#include "pop_stateless_validator.hpp"
17#include "rewards/default_poprewards_calculator.hpp"
50 static std::shared_ptr<PopContext>
create(
51 std::shared_ptr<Config> config,
52 std::shared_ptr<PayloadsStorage> payloadsProvider,
53 std::shared_ptr<BlockReader> blockProvider,
54 std::unique_ptr<EthashCache> ethashCache,
55 std::unique_ptr<ProgpowHeaderCache> progpowHeaderCache,
56 size_t validatorWorkers = 0);
153 const std::vector<uint8_t>& endorsedBlockHeader,
154 const std::vector<uint8_t>& txMerkleRoot,
156 const std::vector<uint8_t>& payoutInfo);
158 VBK_CHECK_RETURN
const Config& getConfig()
const;
159 VBK_CHECK_RETURN
MemPool& getMemPool();
161 VBK_CHECK_RETURN
const AltBlockTree& getAltBlockTree()
const;
162 VBK_CHECK_RETURN
const VbkBlockTree& getVbkBlockTree()
const;
163 VBK_CHECK_RETURN
const BtcBlockTree& getBtcBlockTree()
const;
171 std::shared_ptr<Config> config_;
172 std::shared_ptr<MemPool> mempool_;
173 std::shared_ptr<AltBlockTree> altTree_;
174 std::shared_ptr<PopValidator> popValidator_;
175 std::shared_ptr<PopRewardsCalculator> popRewardsCalculator_;
176 std::shared_ptr<PayloadsStorage> payloadsProvider_;
177 std::shared_ptr<BlockReader> blockProvider_;
Class that is used for storing validation state.
Altchains must configure AltBlockTree prior any usage by providing bootstrapping Config.
Represents simplified view on Altchain's block tree, maintains VBK tree and BTC tree.
An interface which represents single write batch of a group of blocks.
BlockTree is a tree of blocks with single "bootstrap" block as root.
A container for Bitcoin and Veriblock configuration data.
Data structure, that stores in memory all valid payloads (ATV, VTB, VbkBlock) submitted by other peer...
Main entrypoint into the veriblock-pop library.
void shutdown()
stops PopContext internal thread pool used for stateless validation.
VBK_CHECK_RETURN bool getPopPayout(const AltBlockTree::hash_t &prev, PopPayouts &rewards, ValidationState &state)
Calculates POP rewards that should be paid in the next block after prev.
VBK_CHECK_RETURN bool check(const PopData &payload, ValidationState &state)
Checks PopData (stateless check).
VBK_CHECK_RETURN bool check(const ATV &payload, ValidationState &state)
Checks ATV (stateless check).
VBK_CHECK_RETURN bool loadAllTrees(bool fast_load, ValidationState &state)
Load ALT/VBK/BTC trees from disk via adapter BlockReader.
static std::shared_ptr< PopContext > create(std::shared_ptr< Config > config, std::shared_ptr< PayloadsStorage > payloadsProvider, std::shared_ptr< BlockReader > blockProvider, std::unique_ptr< EthashCache > ethashCache, std::unique_ptr< ProgpowHeaderCache > progpowHeaderCache, size_t validatorWorkers=0)
Factory function for PopContext.
VBK_CHECK_RETURN PopData generatePopData()
Generate PopData for the block next to the current tip.
VBK_CHECK_RETURN bool check(const VbkBlock &payload, ValidationState &state)
Checks VbkBlock (stateless check).
void saveAllTrees(BlockBatch &batch) const
Save ALT/VBK/BTC trees on disk via adapter BlockBatch.
VBK_CHECK_RETURN bool generatePublicationData(PublicationData &output, const std::vector< uint8_t > &endorsedBlockHeader, const std::vector< uint8_t > &txMerkleRoot, const PopData &popData, const std::vector< uint8_t > &payoutInfo)
Create PublicationData given required input parameters.
VBK_CHECK_RETURN bool check(const VTB &payload, ValidationState &state)
Checks VTB (stateless check).
Represents ALT block body of POP-related info.
A container for Pop payouts information.
Publication data about ALT block inside VBK blockchain.
Veriblock to Bitcoin publication, committed to Veriblock blockchain in containingBlock.