Wire Sysio Wire Sysion 1.0.0
Loading...
Searching...
No Matches
block_state.hpp
Go to the documentation of this file.
1#pragma once
2
7
8namespace sysio { namespace chain {
9
13 const protocol_feature_set& pfs,
14 const std::function<void( block_timestamp_type,
15 const flat_set<digest_type>&,
16 const vector<digest_type>& )>& validator,
17 bool skip_validate_signee
18 );
19
21 signed_block_ptr&& b, // unsigned block
23 const protocol_feature_set& pfs,
24 const std::function<void( block_timestamp_type,
25 const flat_set<digest_type>&,
26 const vector<digest_type>& )>& validator,
27 const signer_callback_type& signer
28 );
29
30 block_state() = default;
31
32
34
35 private: // internal use only, not thread safe
36 friend struct fc::reflector<block_state>;
37 friend bool block_state_is_valid( const block_state& ); // work-around for multi-index access
38 friend struct controller_impl;
39 friend class fork_database;
40 friend struct fork_database_impl;
42 friend struct pending_state;
43
44 bool is_valid()const { return validated; }
45 bool is_pub_keys_recovered()const { return _pub_keys_recovered; }
46
47 vector<transaction_metadata_ptr> extract_trxs_metas() {
48 _pub_keys_recovered = false;
49 auto result = std::move( _cached_trxs );
50 _cached_trxs.clear();
51 return result;
52 }
53 void set_trxs_metas( vector<transaction_metadata_ptr>&& trxs_metas, bool keys_recovered ) {
54 _pub_keys_recovered = keys_recovered;
55 _cached_trxs = std::move( trxs_metas );
56 }
57 const vector<transaction_metadata_ptr>& trxs_metas()const { return _cached_trxs; }
58
59 bool validated = false;
60
61 bool _pub_keys_recovered = false;
64 vector<transaction_metadata_ptr> _cached_trxs;
65 };
66
67 using block_state_ptr = std::shared_ptr<block_state>;
68 using branch_type = deque<block_state_ptr>;
69
70} }
71
manages light-weight state for all potential unconfirmed forks
std::function< std::vector< signature_type >(const digest_type &)> signer_callback_type
deque< block_state_ptr > branch_type
std::shared_ptr< signed_block > signed_block_ptr
Definition block.hpp:105
std::shared_ptr< block_state > block_state_ptr
#define FC_REFLECT_DERIVED(TYPE, INHERITS, MEMBERS)
Specializes fc::reflector for TYPE where type inherits other reflected classes.
Definition reflect.hpp:298
defines visit functions for T Unless this is specialized, visit() will not be defined for T.
Definition reflect.hpp:33
defines the minimum state necessary to validate transaction headers
const block_id_type & prev() const
friend bool block_state_is_valid(const block_state &)