veriblock-pop-cpp
C++11 Libraries for leveraging VeriBlock Proof-Of-Proof blockchain technology.
pop_context.h
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 VERIBLOCK_POP_CPP_C_POP_CONTEXT_H
7#define VERIBLOCK_POP_CPP_C_POP_CONTEXT_H
8
9#include <stdint.h>
10
11#include "veriblock/pop/c/config.h"
12#include "veriblock/pop/c/entities/altblock.h"
13#include "veriblock/pop/c/entities/block_index.h"
14#include "veriblock/pop/c/entities/pop_payouts.h"
15#include "veriblock/pop/c/entities/popdata.h"
16#include "veriblock/pop/c/storage.h"
17#include "veriblock/pop/c/type_helpers.h"
18#include "veriblock/pop/c/validation_state.h"
19
20#ifdef __cplusplus
21extern "C" {
22#endif
23
24POP_DECLARE_ENTITY(pop_context);
25
26POP_ENTITY_NEW_FUNCTION(pop_context,
27 const POP_ENTITY_NAME(config) * config,
28 const POP_ENTITY_NAME(storage) * storage,
29 POP_ARRAY_NAME(string) log_lvl);
30
41POP_ENTITY_CUSTOM_FUNCTION(pop_context,
42 bool,
43 accept_block_header,
44 const POP_ENTITY_NAME(alt_block) * block,
45 POP_ENTITY_NAME(validation_state) * state);
46
56POP_ENTITY_CUSTOM_FUNCTION(pop_context,
57 void,
58 accept_block,
59 POP_ARRAY_NAME(u8) hash,
60 const POP_ENTITY_NAME(pop_data) * pop_data);
61
75POP_ENTITY_CUSTOM_FUNCTION(pop_context,
76 bool,
77 set_state,
78 POP_ARRAY_NAME(u8) hash,
79 POP_ENTITY_NAME(validation_state) * state);
80
95POP_ENTITY_CUSTOM_FUNCTION(pop_context,
96 int,
97 compare_pop_score,
98 POP_ARRAY_NAME(u8) A_block_hash,
99 POP_ARRAY_NAME(u8) B_block_hash);
100
115POP_ENTITY_CUSTOM_FUNCTION(pop_context,
116 POP_ARRAY_NAME(pop_payout),
117 get_pop_payouts,
118 POP_ARRAY_NAME(u8) hash,
119 POP_ENTITY_NAME(validation_state) * state);
120
128POP_ENTITY_CUSTOM_FUNCTION(pop_context,
129 void,
130 remove_subtree,
131 POP_ARRAY_NAME(u8) hash);
132
142POP_ENTITY_CUSTOM_FUNCTION(pop_context,
143 POP_ENTITY_NAME(alt_block_index) *,
144 alt_get_block_index,
145 POP_ARRAY_NAME(u8) hash,
146 POP_ENTITY_NAME(validation_state) * state);
147
157POP_ENTITY_CUSTOM_FUNCTION(pop_context,
158 POP_ENTITY_NAME(vbk_block_index) *,
159 vbk_get_block_index,
160 POP_ARRAY_NAME(u8) hash,
161 POP_ENTITY_NAME(validation_state) * state);
162
172POP_ENTITY_CUSTOM_FUNCTION(pop_context,
173 POP_ENTITY_NAME(btc_block_index) *,
174 btc_get_block_index,
175 POP_ARRAY_NAME(u8) hash,
176 POP_ENTITY_NAME(validation_state) * state);
177
185POP_ENTITY_CUSTOM_FUNCTION(pop_context,
186 POP_ENTITY_NAME(alt_block_index) *,
187 alt_get_best_block);
188
196POP_ENTITY_CUSTOM_FUNCTION(pop_context,
197 POP_ENTITY_NAME(vbk_block_index) *,
198 vbk_get_best_block);
199
207POP_ENTITY_CUSTOM_FUNCTION(pop_context,
208 POP_ENTITY_NAME(btc_block_index) *,
209 btc_get_best_block);
210
217POP_ENTITY_CUSTOM_FUNCTION(pop_context,
218 POP_ENTITY_NAME(alt_block_index) *,
219 alt_get_bootstrap_block);
220
227POP_ENTITY_CUSTOM_FUNCTION(pop_context,
228 POP_ENTITY_NAME(vbk_block_index) *,
229 vbk_get_bootstrap_block);
230
237POP_ENTITY_CUSTOM_FUNCTION(pop_context,
238 POP_ENTITY_NAME(btc_block_index) *,
239 btc_get_bootstrap_block);
240
250POP_ENTITY_CUSTOM_FUNCTION(pop_context,
251 POP_ENTITY_NAME(alt_block_index) *,
252 alt_get_block_at_active_chain,
253 uint32_t height);
254
264POP_ENTITY_CUSTOM_FUNCTION(pop_context,
265 POP_ENTITY_NAME(vbk_block_index) *,
266 vbk_get_block_at_active_chain,
267 uint32_t height);
268
278POP_ENTITY_CUSTOM_FUNCTION(pop_context,
279 POP_ENTITY_NAME(btc_block_index) *,
280 btc_get_block_at_active_chain,
281 uint32_t height);
282
283POP_ENTITY_CUSTOM_FUNCTION(pop_context,
284 POP_ARRAY_NAME(array_u8),
285 get_payload_containing_blocks,
286 POP_ARRAY_NAME(u8) id);
287
288#ifdef __cplusplus
289} // end of extern "C"
290#endif
291
292#endif