6#ifndef VERIBLOCK_POP_CPP_ALT_BLOCK_ADDON_HPP
7#define VERIBLOCK_POP_CPP_ALT_BLOCK_ADDON_HPP
14#include "veriblock/pop/assert.hpp"
15#include "veriblock/pop/blockchain/block_status.hpp"
16#include "veriblock/pop/blockchain/pop/pop_state.hpp"
17#include "veriblock/pop/entities/endorsements.hpp"
18#include "veriblock/pop/uint.hpp"
28struct AltBlockAddon :
public PopState<AltEndorsement> {
29 using payloads_t = PopData;
31 void setNullInmemFields();
35 bool hasPayloads()
const;
39 template <
typename pop_t>
40 const std::vector<typename pop_t::id_t>& getPayloadIds()
const;
43 template <
typename pop_t>
44 void removePayloadId(
const typename pop_t::id_t& pid) {
45 auto& payloads = getPayloadIdsInner<pop_t>();
46 auto it = std::find(payloads.begin(), payloads.end(), pid);
47 VBK_ASSERT(it != payloads.end());
52 template <
typename pop_t>
53 void setPayloads(
const std::vector<typename pop_t::id_t>& pids) {
54 auto& payloads = getPayloadIdsInner<pop_t>();
60 template <
typename pop_t>
61 void insertPayloadIds(
const std::vector<typename pop_t::id_t>& pids) {
62 auto& payloads = getPayloadIdsInner<pop_t>();
63 payloads.insert(payloads.end(), pids.begin(), pids.end());
67 std::string toPrettyString()
const;
69 void toVbkEncoding(WriteStream& w)
const;
74 std::vector<uint256> _atvids;
76 std::vector<uint256> _vtbids;
78 std::vector<uint96> _vbkblockids;
84 int32_t minContainingVbkBlockHeight = std::numeric_limits<int32_t>::max();
90 template <
typename pop_t>
91 std::vector<typename pop_t::id_t>& getPayloadIdsInner();
95 ValidationState& state);
Class that is used for storing validation state.
@ BLOCK_CONNECTED
the block is connected via connectBlock, which means that this block and all its ancestors are at lea...
bool DeserializeFromVbkEncoding(ReadStream &stream, AltBlockAddon &out, ValidationState &state)
This is an overloaded member function, provided for convenience. It differs from the above function o...
Binary reading stream, that is useful during binary deserialization.