forked from qdrvm/kagome
-
Notifications
You must be signed in to change notification settings - Fork 0
/
block_builder.hpp
47 lines (37 loc) · 1.28 KB
/
block_builder.hpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
/**
* Copyright Soramitsu Co., Ltd. All Rights Reserved.
* SPDX-License-Identifier: Apache-2.0
*/
#ifndef KAGOME_CORE_AUTHORSHIP_BLOCK_BUILDER_HPP
#define KAGOME_CORE_AUTHORSHIP_BLOCK_BUILDER_HPP
#include "primitives/block.hpp"
#include "primitives/extrinsic.hpp"
#include "primitives/inherent_data.hpp"
namespace kagome::authorship {
/**
* BlockBuilder collects extrinsics and creates new block and then should be
* destroyed
*/
class BlockBuilder {
public:
virtual ~BlockBuilder() = default;
virtual outcome::result<std::vector<primitives::Extrinsic>>
getInherentExtrinsics(const primitives::InherentData &data) const = 0;
/**
* Push extrinsic to wait its inclusion to the block
* Returns result containing success if xt was pushed, error otherwise
*/
virtual outcome::result<primitives::ExtrinsicIndex> pushExtrinsic(
const primitives::Extrinsic &extrinsic) = 0;
/**
* Create a block from extrinsics and header
*/
virtual outcome::result<primitives::Block> bake() const = 0;
/**
* Estimate size of encoded block representation
* @return size in bytes
*/
virtual size_t estimateBlockSize() const = 0;
};
} // namespace kagome::authorship
#endif // KAGOME_CORE_AUTHORSHIP_BLOCK_BUILDER_HPP