Wire Sysio Wire Sysion 1.0.0
Loading...
Searching...
No Matches
producer_plugin.hpp
Go to the documentation of this file.
1#pragma once
2
5
7
8namespace sysio {
9
10using boost::signals2::signal;
11
12class producer_plugin : public appbase::plugin<producer_plugin> {
13public:
15
16 struct runtime_options {
17 std::optional<int32_t> max_transaction_time;
18 std::optional<int32_t> max_irreversible_block_age;
19 std::optional<int32_t> produce_time_offset_us;
20 std::optional<int32_t> last_block_time_offset_us;
21 std::optional<int32_t> max_scheduled_transaction_time_per_block_ms;
22 std::optional<int32_t> subjective_cpu_leeway_us;
23 std::optional<double> incoming_defer_ratio;
24 std::optional<uint32_t> greylist_limit;
25 };
26
28 std::optional< flat_set<account_name> > actor_whitelist;
29 std::optional< flat_set<account_name> > actor_blacklist;
30 std::optional< flat_set<account_name> > contract_whitelist;
31 std::optional< flat_set<account_name> > contract_blacklist;
32 std::optional< flat_set< std::pair<account_name, action_name> > > action_blacklist;
33 std::optional< flat_set<public_key_type> > key_blacklist;
34 };
35
37 std::vector<account_name> accounts;
38 };
39
44
52
54 std::vector<chain::digest_type> protocol_features_to_activate;
55 };
56
61
63 std::optional<account_name> lower_bound;
64 std::optional<account_name> upper_bound;
65 uint32_t limit = 10;
66 bool reverse = false;
67 };
68
70 std::vector<fc::variant> rows;
71 std::optional<account_name> more;
72 };
73
74 template<typename T>
75 using next_function = std::function<void(const std::variant<fc::exception_ptr, T>&)>;
76
78 virtual ~producer_plugin();
79
80 virtual void set_program_options(
81 boost::program_options::options_description &command_line_options,
82 boost::program_options::options_description &config_file_options
83 ) override;
84
85 bool is_producer_key(const chain::public_key_type& key) const;
87 int64_t get_subjective_bill( const account_name& first_auth, const fc::time_point& now ) const;
88
89 virtual void plugin_initialize(const boost::program_options::variables_map& options);
90 virtual void plugin_startup();
91 virtual void plugin_shutdown();
92 void handle_sighup() override;
93
94 void pause();
95 void resume();
96 bool paused() const;
97 void update_runtime_options(const runtime_options& options);
98 runtime_options get_runtime_options() const;
99
103
106
109
112
114
116
117 void log_failed_transaction(const transaction_id_type& trx_id, const chain::packed_transaction_ptr& packed_trx_ptr, const char* reason) const;
118
119 // thread-safe, called when a new block is received
120 void received_block();
121
122 private:
123 std::shared_ptr<class producer_plugin_impl> my;
124};
125
126} //sysio
127
128FC_REFLECT(sysio::producer_plugin::runtime_options, (max_transaction_time)(max_irreversible_block_age)(produce_time_offset_us)(last_block_time_offset_us)(max_scheduled_transaction_time_per_block_ms)(subjective_cpu_leeway_us)(incoming_defer_ratio)(greylist_limit));
130FC_REFLECT(sysio::producer_plugin::whitelist_blacklist, (actor_whitelist)(actor_blacklist)(contract_whitelist)(contract_blacklist)(action_blacklist)(key_blacklist) )
132FC_REFLECT(sysio::producer_plugin::snapshot_information, (head_block_id)(head_block_num)(head_block_time)(version)(snapshot_name))
134FC_REFLECT(sysio::producer_plugin::get_supported_protocol_features_params, (exclude_disabled)(exclude_unactivatable))
135FC_REFLECT(sysio::producer_plugin::get_account_ram_corrections_params, (lower_bound)(upper_bound)(limit)(reverse))
virtual void plugin_initialize(const boost::program_options::variables_map &options)
APPBASE_PLUGIN_REQUIRES((chain_plugin)(http_client_plugin)) struct runtime_options
greylist_params get_greylist() const
virtual void set_program_options(boost::program_options::options_description &command_line_options, boost::program_options::options_description &config_file_options) override
chain::signature_type sign_compact(const chain::public_key_type &key, const fc::sha256 &digest) const
void create_snapshot(next_function< snapshot_information > next)
void remove_greylist_accounts(const greylist_params &params)
runtime_options get_runtime_options() const
bool is_producer_key(const chain::public_key_type &key) const
void add_greylist_accounts(const greylist_params &params)
fc::variants get_supported_protocol_features(const get_supported_protocol_features_params &params) const
std::function< void(const std::variant< fc::exception_ptr, T > &)> next_function
whitelist_blacklist get_whitelist_blacklist() const
void schedule_protocol_feature_activations(const scheduled_protocol_feature_activations &schedule)
void set_whitelist_blacklist(const whitelist_blacklist &params)
void log_failed_transaction(const transaction_id_type &trx_id, const chain::packed_transaction_ptr &packed_trx_ptr, const char *reason) const
int64_t get_subjective_bill(const account_name &first_auth, const fc::time_point &now) const
get_account_ram_corrections_result get_account_ram_corrections(const get_account_ram_corrections_params &params) const
void update_runtime_options(const runtime_options &options)
scheduled_protocol_feature_activations get_scheduled_protocol_feature_activations() const
integrity_hash_information get_integrity_hash() const
fc::sha256 digest(const T &value)
Definition digest.hpp:9
std::vector< fc::variant > variants
Definition variant.hpp:173
std::shared_ptr< const packed_transaction > packed_transaction_ptr
#define FC_REFLECT(TYPE, MEMBERS)
Specializes fc::reflector for TYPE.
Definition reflect.hpp:311
signed __int64 int64_t
Definition stdint.h:135
unsigned int uint32_t
Definition stdint.h:126
Immutable except for fc::from_variant.
Definition name.hpp:43
std::optional< flat_set< std::pair< account_name, action_name > > > action_blacklist
std::optional< flat_set< account_name > > contract_whitelist
std::optional< flat_set< account_name > > contract_blacklist
std::optional< flat_set< public_key_type > > key_blacklist
std::optional< flat_set< account_name > > actor_blacklist
std::optional< flat_set< account_name > > actor_whitelist