Wire Sysio Wire Sysion 1.0.0
Loading...
Searching...
No Matches
block.cpp
Go to the documentation of this file.
2
3namespace sysio { namespace chain {
6 "additional_block_signatures_extension expects FC to support reflector_init" );
7
8 SYS_ASSERT( signatures.size() > 0, ill_formed_additional_block_signatures_extension,
9 "Additional block signatures extension must contain at least one signature",
10 );
11
12 set<signature_type> unique_sigs;
13
14 for( const auto& s : signatures ) {
15 auto res = unique_sigs.insert( s );
16 SYS_ASSERT( res.second, ill_formed_additional_block_signatures_extension,
17 "Signature ${s} was repeated in the additional block signatures extension",
18 ("s", s)
19 );
20 }
21 }
22
23 flat_multimap<uint16_t, block_extension> signed_block::validate_and_extract_extensions()const {
24 using decompose_t = block_extension_types::decompose_t;
25
26 flat_multimap<uint16_t, block_extension> results;
27
28 uint16_t id_type_lower_bound = 0;
29
30 for( size_t i = 0; i < block_extensions.size(); ++i ) {
31 const auto& e = block_extensions[i];
32 auto id = e.first;
33
34 SYS_ASSERT( id >= id_type_lower_bound, invalid_block_extension,
35 "Block extensions are not in the correct order (ascending id types required)"
36 );
37
38 auto iter = results.emplace(std::piecewise_construct,
39 std::forward_as_tuple(id),
40 std::forward_as_tuple()
41 );
42
43 auto match = decompose_t::extract<block_extension>( id, e.second, iter->second );
44 SYS_ASSERT( match, invalid_block_extension,
45 "Block extension with id type ${id} is not supported",
46 ("id", id)
47 );
48
49 if( match->enforce_unique ) {
50 SYS_ASSERT( i == 0 || id > id_type_lower_bound, invalid_block_header_extension,
51 "Block extension with id type ${id} is not allowed to repeat",
52 ("id", id)
53 );
54 }
55
56
57 id_type_lower_bound = id;
58 }
59
60 return results;
61
62 }
63
64} }
#define SYS_ASSERT(expr, exc_type, FORMAT,...)
Definition exceptions.hpp:7
uint64_t id
Definition code_cache.cpp:0
constexpr bool has_feature_reflector_init_on_unpacked_reflected_types
Definition raw.hpp:440
unsigned short uint16_t
Definition stdint.h:125
extensions_type block_extensions
new or generated transactions
Definition block.hpp:101
flat_multimap< uint16_t, block_extension > validate_and_extract_extensions() const
Definition block.cpp:23
account_query_db::get_accounts_by_authorizers_result results
char * s