Wire Sysio
Wire Sysion 1.0.0
Loading...
Searching...
No Matches
protocol_feature_activation.cpp
Go to the documentation of this file.
1
#include <
sysio/chain/protocol_feature_activation.hpp
>
2
#include <
sysio/chain/exceptions.hpp
>
3
4
#include <algorithm>
5
6
namespace
sysio
{
namespace
chain {
7
8
void
protocol_feature_activation::reflector_init
() {
9
static_assert
(
fc::raw::has_feature_reflector_init_on_unpacked_reflected_types
,
10
"protocol_feature_activation expects FC to support reflector_init"
);
11
12
13
SYS_ASSERT
(
protocol_features
.size() > 0, ill_formed_protocol_feature_activation,
14
"Protocol feature activation extension must have at least one protocol feature digest"
,
15
);
16
17
set<digest_type>
s
;
18
19
for
(
const
auto
&
d
:
protocol_features
) {
20
auto
res =
s
.insert(
d
);
21
SYS_ASSERT
( res.second, ill_formed_protocol_feature_activation,
22
"Protocol feature digest ${d} was repeated in the protocol feature activation extension"
,
23
(
"d"
,
d
)
24
);
25
}
26
}
27
28
protocol_feature_activation_set::protocol_feature_activation_set
(
29
const
protocol_feature_activation_set
& orig_pfa_set,
30
vector<digest_type>
additional_features,
31
bool
enforce_disjoint
32
)
33
{
34
std::sort( additional_features.begin(), additional_features.end() );
35
36
const
auto
& s1 = orig_pfa_set.
protocol_features
;
37
const
auto
& s2 = additional_features;
38
39
auto
expected_size = s1.size() + s2.size();
40
protocol_features
.reserve( expected_size );
41
42
std::set_union( s1.cbegin(), s1.cend(), s2.cbegin(), s2.cend(),
end_inserter
(
protocol_features
) );
43
44
SYS_ASSERT
( !enforce_disjoint ||
protocol_features
.size() == expected_size,
45
invalid_block_header_extension,
46
"duplication of protocol feature digests"
47
);
48
}
49
50
} }
// sysio::chain
exceptions.hpp
SYS_ASSERT
#define SYS_ASSERT(expr, exc_type, FORMAT,...)
Definition
exceptions.hpp:7
fc::vector
Definition
vector_fwd.hpp:7
fc::raw::has_feature_reflector_init_on_unpacked_reflected_types
constexpr bool has_feature_reflector_init_on_unpacked_reflected_types
Definition
raw.hpp:440
sysio::chain::end_inserter
end_insert_iterator< Container > end_inserter(Container &c)
Definition
types.hpp:303
sysio
Definition
abi_serializer.cpp:8
protocol_feature_activation.hpp
sysio::chain::protocol_feature_activation_set
Definition
protocol_feature_activation.hpp:36
sysio::chain::protocol_feature_activation_set::protocol_features
flat_set< digest_type > protocol_features
Definition
protocol_feature_activation.hpp:37
sysio::chain::protocol_feature_activation_set::protocol_feature_activation_set
protocol_feature_activation_set()=default
sysio::chain::protocol_feature_activation::reflector_init
void reflector_init()
Definition
protocol_feature_activation.cpp:8
sysio::chain::protocol_feature_activation::protocol_features
vector< digest_type > protocol_features
Definition
protocol_feature_activation.hpp:29
d
CK_ULONG d
Definition
yubihsm_pkcs11.c:1238
s
char * s
Definition
yubihsm_pkcs11.c:524
libraries
chain
protocol_feature_activation.cpp
Generated by
1.12.0