veriblock-pop-cpp
C++11 Libraries for leveraging VeriBlock Proof-Of-Proof blockchain technology.
block_status.hpp
1// Copyright (c) 2019-2022 Xenios SEZC
2// https://www.veriblock.org
3// Distributed under the MIT software license, see the accompanying
4// file LICENSE or http://www.opensource.org/licenses/mit-license.php.
5
6#ifndef ALT_INTEGRATION_INCLUDE_VERIBLOCK_BLOCKCHAIN_BLOCK_STATUS_HPP_
7#define ALT_INTEGRATION_INCLUDE_VERIBLOCK_BLOCKCHAIN_BLOCK_STATUS_HPP_
8
9#include <cstdint>
10
11namespace altintegration {
12
14enum BlockStateStatus : uint32_t {
31
36
37};
38
40enum BlockValidityStatus : uint32_t {
43
44 // all values from (0, 15] are reserved for BlockStateStatus
45
61 BLOCK_ACTIVE = 1 << 9,
63 BLOCK_DELETED = 1 << 10
64
65};
66
71constexpr bool isValidInvalidationReason(const BlockValidityStatus& reason) {
72 return reason == BLOCK_FAILED_BLOCK || reason == BLOCK_FAILED_POP;
73}
74
75} // namespace altintegration
76#endif // ALT_INTEGRATION_INCLUDE_VERIBLOCK_BLOCKCHAIN_BLOCK_STATUS_HPP_
Defines logging helpers.
Definition: block.hpp:14
BlockStateStatus
Flags that describe block status.
@ BLOCK_VALID_MASK
all stateful validity levels
@ BLOCK_VALID_TREE
acceptBlockHeader succeded.
@ BLOCK_CONNECTED
the block is connected via connectBlock, which means that this block and all its ancestors are at lea...
@ BLOCK_CAN_BE_APPLIED_MAYBE_WITH_OTHER_CHAIN
the block has been successfully applied, but may not be fully valid, because it may connect to the "o...
@ BLOCK_CAN_BE_APPLIED
the chain with the block at its tip is fully valid, so if we do SetState on this block,...
BlockValidityStatus
Flags that describe block status.
@ BLOCK_FAILED_BLOCK
block is statelessly valid, but the altchain marked it as failed
@ BLOCK_VALID_UNKNOWN
default state for validity - validity state is unknown
@ BLOCK_FAILED_CHILD
block is state{lessly,fully} valid and the altchain did not report it as invalid, but some of the anc...
@ BLOCK_HAS_PAYLOADS
acceptBlockHeader has been executed on this block;
@ BLOCK_DELETED
the block is temporarily deleted
@ BLOCK_ACTIVE
the block is currently applied via SetState.
@ BLOCK_FAILED_MASK
all invalidity flags
@ BLOCK_FAILED_POP
block failed state{less,ful} validation due to its payloads
@ BLOCK_BOOTSTRAP
this is a bootstrap block
constexpr bool isValidInvalidationReason(const BlockValidityStatus &reason)
Check if the reason value can be used as the reason for invalidateSubtree and revalidateSubtree.