BitShares-Core
7.0.2
BitShares blockchain node software and command-line wallet software
|
Go to the documentation of this file.
35 namespace bpo = boost::program_options;
60 (
"trusted-node", boost::program_options::value<std::string>(),
61 "RPC endpoint of a trusted validating node (required for delayed_node)")
71 con = my->client.connect(my->remote_endpoint);
79 my->client_connection = std::make_shared<fc::rpc::websocket_api_connection>(
82 my->database_api->set_block_applied_callback([
this](
const fc::variant& block_id )
86 my->client_connection_closed = my->client_connection->closed.connect([
this] {
93 FC_ASSERT(options.count(
"trusted-node") > 0);
94 my = std::make_unique<detail::delayed_node_plugin_impl>();
95 my->remote_endpoint =
"ws://" + options.at(
"trusted-node").as<std::string>();
101 uint32_t synced_blocks = 0;
102 uint32_t pass_count = 0;
110 wlog(
"Trusted node seems to be behind delayed node" );
112 if( synced_blocks > 1 )
114 ilog(
"Delayed node finished syncing ${n} blocks in ${k} passes", (
"n", synced_blocks)(
"k", pass_count) );
123 FC_ASSERT(block,
"Trusted node claims it has blocks it doesn't actually have.");
126 db.push_block(*block);
140 if( my->last_received_remote_head == my->last_processed_remote_head )
144 my->last_processed_remote_head = my->last_received_remote_head;
165 my->last_received_remote_head = my->last_processed_remote_head;
166 elog(
"Connection to trusted node failed; retrying in 5 seconds...");
The database_api class implements the RPC API for the chain database.
Maintains global state information (committee_member list, current fees)
Used to generate a useful error report when an exception is thrown.
fc::api< graphene::app::database_api > database_api
boost::signals2::scoped_connection client_connection_closed
chain::database & database()
~delayed_node_plugin() override
void sync_with_trusted_node()
#define GRAPHENE_NET_MAX_NESTED_OBJECTS
auto schedule(Functor &&f, const fc::time_point &t, const char *desc FC_TASK_NAME_DEFAULT_ARG, priority prio=priority()) -> fc::future< decltype(f())>
std::shared_ptr< websocket_connection > websocket_connection_ptr
void usleep(const microseconds &u)
void from_variant(const variant &var, flat_set< T, A... > &vo, uint32_t _max_depth)
microseconds seconds(int64_t s)
std::string remote_endpoint
fc::http::websocket_client client
void plugin_startup() override
Begin normal runtime operations.
delayed_node_plugin(graphene::app::application &app)
auto async(Functor &&f, const char *desc FC_TASK_NAME_DEFAULT_ARG, priority prio=priority()) -> fc::future< decltype(f())>
uint32_t last_irreversible_block_num
std::string to_detail_string(log_level ll=log_level::all) const
void plugin_initialize(const boost::program_options::variables_map &options) override
Perform early startup routines and register plugin indexes, callbacks, etc.
void plugin_set_program_options(boost::program_options::options_description &, boost::program_options::options_description &cfg) override
Fill in command line parameters used by the plugin.
#define FC_ASSERT(TEST,...)
Checks a condition and throws an assert_exception if the test is FALSE.
graphene::chain::block_id_type last_received_remote_head
boost::signals2::scoped_connection scoped_connection
stores null, int64, uint64, double, bool, string, std::vector<variant>, and variant_object's.
#define GRAPHENE_MAX_NESTED_OBJECTS
graphene::chain::block_id_type last_processed_remote_head
provides stack-based nullable value similar to boost::optional
std::shared_ptr< fc::rpc::websocket_api_connection > client_connection