BitShares-Core  5.0.0
BitShares blockchain implementation and command-line interface software
node_impl.hxx
Go to the documentation of this file.
1 #pragma once
2 #include <memory>
3 #include <mutex>
4 #include <fc/thread/thread.hpp>
5 #include <fc/log/logger.hpp>
9 #include <graphene/net/node.hpp>
12 
13 namespace graphene { namespace net { namespace detail {
14 
15 /*******
16  * A class to wrap std::unordered_set for multithreading
17  */
18 template <class Key, class Hash = std::hash<Key>, class Pred = std::equal_to<Key> >
19 class concurrent_unordered_set : private std::unordered_set<Key, Hash, Pred>
20 {
21 private:
22  mutable fc::mutex mux;
23 
24 public:
25  // iterations require a lock. This exposes the mutex. Use with care (i.e. lock_guard)
26  fc::mutex& get_mutex()const { return mux; }
27 
28  // insertion
29  std::pair< typename std::unordered_set<Key, Hash, Pred>::iterator, bool> emplace( Key key)
30  {
32  return std::unordered_set<Key, Hash, Pred>::emplace( key );
33  }
34  std::pair< typename std::unordered_set<Key, Hash, Pred>::iterator, bool> insert (const Key& val)
35  {
37  return std::unordered_set<Key, Hash, Pred>::insert( val );
38  }
39  // size
40  size_t size() const
41  {
43  return std::unordered_set<Key, Hash, Pred>::size();
44  }
45  bool empty() const noexcept
46  {
48  return std::unordered_set<Key, Hash, Pred>::empty();
49  }
50  // removal
51  void clear() noexcept
52  {
54  std::unordered_set<Key, Hash, Pred>::clear();
55  }
56  typename std::unordered_set<Key, Hash, Pred>::iterator erase(
57  typename std::unordered_set<Key, Hash, Pred>::const_iterator itr)
58  {
60  return std::unordered_set<Key, Hash, Pred>::erase( itr);
61  }
62  size_t erase( const Key& key)
63  {
65  return std::unordered_set<Key, Hash, Pred>::erase( key );
66  }
67  // iteration
68  typename std::unordered_set<Key, Hash, Pred>::iterator begin() noexcept
69  {
71  return std::unordered_set<Key, Hash, Pred>::begin();
72  }
73  typename std::unordered_set<Key, Hash, Pred>::const_iterator begin() const noexcept
74  {
76  return std::unordered_set<Key, Hash, Pred>::begin();
77  }
78  typename std::unordered_set<Key, Hash, Pred>::local_iterator begin(size_t n)
79  {
81  return std::unordered_set<Key, Hash, Pred>::begin(n);
82  }
83  typename std::unordered_set<Key, Hash, Pred>::const_local_iterator begin(size_t n) const
84  {
86  return std::unordered_set<Key, Hash, Pred>::begin(n);
87  }
88  typename std::unordered_set<Key, Hash, Pred>::iterator end() noexcept
89  {
91  return std::unordered_set<Key, Hash, Pred>::end();
92  }
93  typename std::unordered_set<Key, Hash, Pred>::const_iterator end() const noexcept
94  {
96  return std::unordered_set<Key, Hash, Pred>::end();
97  }
98  typename std::unordered_set<Key, Hash, Pred>::local_iterator end(size_t n)
99  {
100  fc::scoped_lock<fc::mutex> lock(mux);
101  return std::unordered_set<Key, Hash, Pred>::end(n);
102  }
103  typename std::unordered_set<Key, Hash, Pred>::const_local_iterator end(size_t n) const
104  {
105  fc::scoped_lock<fc::mutex> lock(mux);
106  return std::unordered_set<Key, Hash, Pred>::end(n);
107  }
108  // search
109  typename std::unordered_set<Key, Hash, Pred>::const_iterator find(Key key)
110  {
111  fc::scoped_lock<fc::mutex> lock(mux);
112  return std::unordered_set<Key, Hash, Pred>::find(key);
113  }
114 };
115 
116 // when requesting items from peers, we want to prioritize any blocks before
117 // transactions, but otherwise request items in the order we heard about them
119 {
121  unsigned sequence_number;
122  fc::time_point timestamp; // the time we last heard about this item in an inventory message
123 
124  prioritized_item_id(const item_id& item, unsigned sequence_number) :
125  item(item),
126  sequence_number(sequence_number),
127  timestamp(fc::time_point::now())
128  {}
129  bool operator<(const prioritized_item_id& rhs) const
130  {
132  "block_message_type must be greater than trx_message_type for prioritized_item_ids to sort correctly");
133  if (item.item_type != rhs.item.item_type)
134  return item.item_type > rhs.item.item_type;
135  return (signed)(rhs.sequence_number - sequence_number) > 0;
136  }
137 };
138 
140 {
141 private:
142  node_delegate *_node_delegate;
143  fc::thread *_thread;
144 
145  typedef boost::accumulators::accumulator_set<int64_t, boost::accumulators::stats<boost::accumulators::tag::min,
146  boost::accumulators::tag::rolling_mean,
147  boost::accumulators::tag::max,
148  boost::accumulators::tag::sum,
149  boost::accumulators::tag::count> > call_stats_accumulator;
150 #define NODE_DELEGATE_METHOD_NAMES (has_item) \
151  (handle_message) \
152  (handle_block) \
153  (handle_transaction) \
154  (get_block_ids) \
155  (get_item) \
156  (get_chain_id) \
157  (get_blockchain_synopsis) \
158  (sync_status) \
159  (connection_count_changed) \
160  (get_block_number) \
161  (get_block_time) \
162  (get_head_block_id) \
163  (estimate_last_known_fork_from_git_revision_timestamp) \
164  (error_encountered) \
165  (get_current_block_interval_in_seconds)
166 
167 
168 
169 #define DECLARE_ACCUMULATOR(r, data, method_name) \
170  mutable call_stats_accumulator BOOST_PP_CAT(_, BOOST_PP_CAT(method_name, _execution_accumulator)); \
171  mutable call_stats_accumulator BOOST_PP_CAT(_, BOOST_PP_CAT(method_name, _delay_before_accumulator)); \
172  mutable call_stats_accumulator BOOST_PP_CAT(_, BOOST_PP_CAT(method_name, _delay_after_accumulator));
173  BOOST_PP_SEQ_FOR_EACH(DECLARE_ACCUMULATOR, unused, NODE_DELEGATE_METHOD_NAMES)
174 #undef DECLARE_ACCUMULATOR
175 
176  class call_statistics_collector
177  {
178  private:
179  fc::time_point _call_requested_time;
180  fc::time_point _begin_execution_time;
181  fc::time_point _execution_completed_time;
182  const char* _method_name;
183  call_stats_accumulator* _execution_accumulator;
184  call_stats_accumulator* _delay_before_accumulator;
185  call_stats_accumulator* _delay_after_accumulator;
186  public:
188  {
189  std::shared_ptr<call_statistics_collector> _collector;
190  public:
191  actual_execution_measurement_helper(std::shared_ptr<call_statistics_collector> collector) :
192  _collector(collector)
193  {
194  _collector->starting_execution();
195  }
197  {
198  _collector->execution_completed();
199  }
200  };
201  call_statistics_collector(const char* method_name,
202  call_stats_accumulator* execution_accumulator,
203  call_stats_accumulator* delay_before_accumulator,
204  call_stats_accumulator* delay_after_accumulator) :
205  _call_requested_time(fc::time_point::now()),
206  _method_name(method_name),
207  _execution_accumulator(execution_accumulator),
208  _delay_before_accumulator(delay_before_accumulator),
209  _delay_after_accumulator(delay_after_accumulator)
210  {}
211  ~call_statistics_collector()
212  {
214  fc::microseconds actual_execution_time(_execution_completed_time - _begin_execution_time);
215  fc::microseconds delay_before(_begin_execution_time - _call_requested_time);
216  fc::microseconds delay_after(end_time - _execution_completed_time);
217  fc::microseconds total_duration(actual_execution_time + delay_before + delay_after);
218  (*_execution_accumulator)(actual_execution_time.count());
219  (*_delay_before_accumulator)(delay_before.count());
220  (*_delay_after_accumulator)(delay_after.count());
221  if (total_duration > fc::milliseconds(500))
222  {
223  ilog("Call to method node_delegate::${method} took ${total_duration}us, longer than our target maximum of 500ms",
224  ("method", _method_name)
225  ("total_duration", total_duration.count()));
226  ilog("Actual execution took ${execution_duration}us, with a ${delegate_delay}us delay before the delegate thread started "
227  "executing the method, and a ${p2p_delay}us delay after it finished before the p2p thread started processing the response",
228  ("execution_duration", actual_execution_time)
229  ("delegate_delay", delay_before)
230  ("p2p_delay", delay_after));
231  }
232  }
233  void starting_execution()
234  {
235  _begin_execution_time = fc::time_point::now();
236  }
237  void execution_completed()
238  {
239  _execution_completed_time = fc::time_point::now();
240  }
241  };
242  public:
243  statistics_gathering_node_delegate_wrapper(node_delegate* delegate, fc::thread* thread_for_delegate_calls);
244 
245  fc::variant_object get_call_statistics();
246 
247  bool has_item( const graphene::net::item_id& id ) override;
248  void handle_message( const message& ) override;
249  bool handle_block( const graphene::net::block_message& block_message, bool sync_mode, std::vector<fc::uint160_t>& contained_transaction_message_ids ) override;
250  void handle_transaction( const graphene::net::trx_message& transaction_message ) override;
251  std::vector<item_hash_t> get_block_ids(const std::vector<item_hash_t>& blockchain_synopsis,
252  uint32_t& remaining_item_count,
253  uint32_t limit = 2000) override;
254  message get_item( const item_id& id ) override;
255  graphene::protocol::chain_id_type get_chain_id() const override;
256  std::vector<item_hash_t> get_blockchain_synopsis(const item_hash_t& reference_point,
257  uint32_t number_of_blocks_after_reference_point) override;
258  void sync_status( uint32_t item_type, uint32_t item_count ) override;
259  void connection_count_changed( uint32_t c ) override;
260  uint32_t get_block_number(const item_hash_t& block_id) override;
261  fc::time_point_sec get_block_time(const item_hash_t& block_id) override;
262  item_hash_t get_head_block_id() const override;
263  uint32_t estimate_last_known_fork_from_git_revision_timestamp(uint32_t unix_timestamp) const override;
264  void error_encountered(const std::string& message, const fc::oexception& error) override;
265  uint8_t get_current_block_interval_in_seconds() const override;
266  };
267 
269 {
270  public:
271 #ifdef P2P_IN_DEDICATED_THREAD
272  std::shared_ptr<fc::thread> _thread;
273 #endif // P2P_IN_DEDICATED_THREAD
274  std::unique_ptr<statistics_gathering_node_delegate_wrapper> _delegate;
276 
277 #define NODE_CONFIGURATION_FILENAME "node_config.json"
278 #define POTENTIAL_PEER_DATABASE_FILENAME "peers.json"
281 
283  // _node_configuration.listen_endpoint, unless that endpoint was already
284  // in use.
286 
292 
294  // @{
295  std::list<potential_peer_record> _add_once_node_list;
296 
301  // @}
302 
304  // @{
308 
309  typedef std::unordered_map<graphene::net::block_id_type, fc::time_point> active_sync_requests_map;
310 
311  active_sync_requests_map _active_sync_requests;
312  std::list<graphene::net::block_message> _new_received_sync_items;
313  std::list<graphene::net::block_message> _received_sync_items;
314  // @}
315 
318 
320  // @{
324 
325  struct item_id_index{};
326  typedef boost::multi_index_container<prioritized_item_id,
327  boost::multi_index::indexed_by<boost::multi_index::ordered_unique<boost::multi_index::identity<prioritized_item_id> >,
328  boost::multi_index::hashed_unique<boost::multi_index::tag<item_id_index>,
329  boost::multi_index::member<prioritized_item_id, item_id, &prioritized_item_id::item>,
330  std::hash<item_id> > >
335  // @}
336 
338  // @{
341  std::unordered_set<item_id> _new_inventory;
342  // @}
343 
345  uint8_t _recent_block_interval_in_seconds; // a cached copy of the block interval, to avoid a thread hop to the blockchain to get the current value
346 
347  std::string _user_agent_string;
362 
371 
374 
384 
385  boost::circular_buffer<item_hash_t> _most_recent_blocks_accepted; // the /n/ most recent blocks we've accepted (currently tuned to the max number of connections)
386 
387  uint32_t _sync_item_type;
389  std::vector<uint32_t> _hard_fork_block_numbers;
390 
392 
394 
395  uint32_t _last_reported_number_of_connections; // number of connections last reported to the client (to avoid sending duplicate messages)
396 
398 
400 
401  boost::circular_buffer<uint32_t> _average_network_read_speed_seconds;
402  boost::circular_buffer<uint32_t> _average_network_write_speed_seconds;
403  boost::circular_buffer<uint32_t> _average_network_read_speed_minutes;
404  boost::circular_buffer<uint32_t> _average_network_write_speed_minutes;
405  boost::circular_buffer<uint32_t> _average_network_read_speed_hours;
406  boost::circular_buffer<uint32_t> _average_network_write_speed_hours;
409 
412 
414 
415  /* We have two alternate paths through the schedule_peer_for_deletion code -- one that
416  * uses a mutex to prevent one fiber from adding items to the queue while another is deleting
417  * items from it, and one that doesn't. The one that doesn't is simpler and more efficient
418  * code, but we're keeping around the version that uses the mutex because it crashes, and
419  * this crash probably indicates a bug in our underlying threading code that needs
420  * fixing. To produce the bug, define USE_PEERS_TO_DELETE_MUTEX and then connect up
421  * to the network and set your desired/max connection counts high
422  */
423 //#define USE_PEERS_TO_DELETE_MUTEX 1
424 #ifdef USE_PEERS_TO_DELETE_MUTEX
425  fc::mutex _peers_to_delete_mutex;
426 #endif
427  std::list<peer_connection_ptr> _peers_to_delete;
429 
430 #ifdef ENABLE_P2P_DEBUGGING_API
431  std::set<node_id_t> _allowed_peers;
432 #endif // ENABLE_P2P_DEBUGGING_API
433 
434  bool _node_is_shutting_down; // set to true when we begin our destructor, used to prevent us from starting new tasks while we're shutting down
435 
439 
440  std::list<fc::future<void> > _handle_message_calls_in_progress;
441 
443  // @{
444  boost::container::flat_set<std::string> _seed_nodes;
446  void update_seed_nodes_task();
447  void schedule_next_update_seed_nodes_task();
448  // @}
449 
450  node_impl(const std::string& user_agent);
451  virtual ~node_impl();
452 
453  void save_node_configuration();
454 
455  void p2p_network_connect_loop();
456  void trigger_p2p_network_connect_loop();
457 
458  bool have_already_received_sync_item( const item_hash_t& item_hash );
459  void request_sync_item_from_peer( const peer_connection_ptr& peer, const item_hash_t& item_to_request );
460  void request_sync_items_from_peer( const peer_connection_ptr& peer, const std::vector<item_hash_t>& items_to_request );
461  void fetch_sync_items_loop();
462  void trigger_fetch_sync_items_loop();
463 
464  bool is_item_in_any_peers_inventory(const item_id& item) const;
465  void fetch_items_loop();
466  void trigger_fetch_items_loop();
467 
468  void advertise_inventory_loop();
469  void trigger_advertise_inventory_loop();
470 
471  void terminate_inactive_connections_loop();
472 
473  void fetch_updated_peer_lists_loop();
474  void update_bandwidth_data(uint32_t bytes_read_this_second, uint32_t bytes_written_this_second);
475  void bandwidth_monitor_loop();
476  void dump_node_status_task();
477 
478  bool is_accepting_new_connections();
479  bool is_wanting_new_connections();
480  uint32_t get_number_of_connections();
481  peer_connection_ptr get_peer_by_node_id(const node_id_t& id);
482 
483  bool is_already_connected_to_id(const node_id_t& node_id);
484  bool merge_address_info_with_potential_peer_database( const std::vector<address_info> addresses );
485  void display_current_connections();
486  uint32_t calculate_unsynced_block_count_from_all_peers();
487  std::vector<item_hash_t> create_blockchain_synopsis_for_peer( const peer_connection* peer );
488  void fetch_next_batch_of_item_ids_from_peer( peer_connection* peer, bool reset_fork_tracking_data_for_peer = false );
489 
490  fc::variant_object generate_hello_user_data();
491  void parse_hello_user_data_for_peer( peer_connection* originating_peer, const fc::variant_object& user_data );
492 
493  void on_message( peer_connection* originating_peer,
494  const message& received_message ) override;
495 
496  void on_hello_message( peer_connection* originating_peer,
497  const hello_message& hello_message_received );
498 
499  void on_connection_accepted_message( peer_connection* originating_peer,
500  const connection_accepted_message& connection_accepted_message_received );
501 
502  void on_connection_rejected_message( peer_connection* originating_peer,
503  const connection_rejected_message& connection_rejected_message_received );
504 
505  void on_address_request_message( peer_connection* originating_peer,
506  const address_request_message& address_request_message_received );
507 
508  void on_address_message( peer_connection* originating_peer,
509  const address_message& address_message_received );
510 
511  void on_fetch_blockchain_item_ids_message( peer_connection* originating_peer,
512  const fetch_blockchain_item_ids_message& fetch_blockchain_item_ids_message_received );
513 
514  void on_blockchain_item_ids_inventory_message( peer_connection* originating_peer,
515  const blockchain_item_ids_inventory_message& blockchain_item_ids_inventory_message_received );
516 
517  void on_fetch_items_message( peer_connection* originating_peer,
518  const fetch_items_message& fetch_items_message_received );
519 
520  void on_item_not_available_message( peer_connection* originating_peer,
521  const item_not_available_message& item_not_available_message_received );
522 
523  void on_item_ids_inventory_message( peer_connection* originating_peer,
524  const item_ids_inventory_message& item_ids_inventory_message_received );
525 
526  void on_closing_connection_message( peer_connection* originating_peer,
527  const closing_connection_message& closing_connection_message_received );
528 
529  void on_current_time_request_message( peer_connection* originating_peer,
530  const current_time_request_message& current_time_request_message_received );
531 
532  void on_current_time_reply_message( peer_connection* originating_peer,
533  const current_time_reply_message& current_time_reply_message_received );
534 
535  void forward_firewall_check_to_next_available_peer(firewall_check_state_data* firewall_check_state);
536 
537  void on_check_firewall_message(peer_connection* originating_peer,
538  const check_firewall_message& check_firewall_message_received);
539 
540  void on_check_firewall_reply_message(peer_connection* originating_peer,
541  const check_firewall_reply_message& check_firewall_reply_message_received);
542 
543  void on_get_current_connections_request_message(peer_connection* originating_peer,
544  const get_current_connections_request_message& get_current_connections_request_message_received);
545 
546  void on_get_current_connections_reply_message(peer_connection* originating_peer,
547  const get_current_connections_reply_message& get_current_connections_reply_message_received);
548 
549  void on_connection_closed(peer_connection* originating_peer) override;
550 
551  void send_sync_block_to_node_delegate(const graphene::net::block_message& block_message_to_send);
552  void process_backlog_of_sync_blocks();
553  void trigger_process_backlog_of_sync_blocks();
554  void process_block_during_sync(peer_connection* originating_peer, const graphene::net::block_message& block_message, const message_hash_type& message_hash);
555  void process_block_during_normal_operation(peer_connection* originating_peer, const graphene::net::block_message& block_message, const message_hash_type& message_hash);
556  void process_block_message(peer_connection* originating_peer, const message& message_to_process, const message_hash_type& message_hash);
557 
558  void process_ordinary_message(peer_connection* originating_peer, const message& message_to_process, const message_hash_type& message_hash);
559 
560  void start_synchronizing();
561  void start_synchronizing_with_peer(const peer_connection_ptr& peer);
562 
563  void new_peer_just_added(const peer_connection_ptr& peer);
564 
565  void close();
566 
567  void accept_connection_task(peer_connection_ptr new_peer);
568  void accept_loop();
569  void send_hello_message(const peer_connection_ptr& peer);
570  void connect_to_task(peer_connection_ptr new_peer, const fc::ip::endpoint& remote_endpoint);
571  bool is_connection_to_endpoint_in_progress(const fc::ip::endpoint& remote_endpoint);
572 
573  void move_peer_to_active_list(const peer_connection_ptr& peer);
574  void move_peer_to_closing_list(const peer_connection_ptr& peer);
575  void move_peer_to_terminating_list(const peer_connection_ptr& peer);
576 
577  peer_connection_ptr get_connection_to_endpoint( const fc::ip::endpoint& remote_endpoint );
578 
579  void dump_node_status();
580 
581  void delayed_peer_deletion_task();
582  void schedule_peer_for_deletion(const peer_connection_ptr& peer_to_delete);
583 
584  void disconnect_from_peer( peer_connection* originating_peer,
585  const std::string& reason_for_disconnect,
586  bool caused_by_error = false,
587  const fc::oexception& additional_data = fc::oexception() );
588 
589  // methods implementing node's public interface
590  void set_node_delegate(node_delegate* del, fc::thread* thread_for_delegate_calls);
591  void load_configuration( const fc::path& configuration_directory );
592  void listen_to_p2p_network();
593  void connect_to_p2p_network();
594  void add_node( const fc::ip::endpoint& ep );
595  void add_seed_node( const std::string& seed_string );
596  void resolve_seed_node_and_add( const std::string& seed_string );
597  void initiate_connect_to(const peer_connection_ptr& peer);
598  void connect_to_endpoint(const fc::ip::endpoint& ep);
599  void listen_on_endpoint(const fc::ip::endpoint& ep , bool wait_if_not_available);
600  void accept_incoming_connections(bool accept);
601  void listen_on_port( uint16_t port, bool wait_if_not_available );
602 
603  fc::ip::endpoint get_actual_listening_endpoint() const;
604  std::vector<peer_status> get_connected_peers() const;
605  uint32_t get_connection_count() const;
606 
607  void broadcast(const message& item_to_broadcast, const message_propagation_data& propagation_data);
608  void broadcast(const message& item_to_broadcast);
609  void sync_from(const item_id& current_head_block, const std::vector<uint32_t>& hard_fork_block_numbers);
610  bool is_connected() const;
611  std::vector<potential_peer_record> get_potential_peers() const;
612  void set_advanced_node_parameters( const fc::variant_object& params );
613 
614  fc::variant_object get_advanced_node_parameters();
615  message_propagation_data get_transaction_propagation_data( const graphene::net::transaction_id_type& transaction_id );
616  message_propagation_data get_block_propagation_data( const graphene::net::block_id_type& block_id );
617 
618  node_id_t get_node_id() const;
619  void set_allowed_peers( const std::vector<node_id_t>& allowed_peers );
620  void clear_peer_database();
621  void set_total_bandwidth_limit( uint32_t upload_bytes_per_second, uint32_t download_bytes_per_second );
622  void disable_peer_advertising();
623  fc::variant_object get_call_statistics() const;
624  message get_message_for_item(const item_id& item) override;
625 
626  fc::variant_object network_get_info() const;
627  fc::variant_object network_get_usage_stats() const;
628 
629  bool is_hard_fork_block(uint32_t block_number) const;
630  uint32_t get_next_known_hard_fork_block_number(uint32_t block_number) const;
631  }; // end class node_impl
632 
633 }}} // end of namespace graphene::net::detail
std::unordered_set< Key, Hash, Pred >::local_iterator end(size_t n)
Definition: node_impl.hxx:98
#define DECLARE_ACCUMULATOR(r, data, method_name)
Definition: node_impl.hxx:169
unsigned _maximum_number_of_blocks_to_handle_at_one_time
Definition: node_impl.hxx:436
fc::promise< void >::ptr _retrigger_fetch_sync_items_loop_promise
used by the task that fetches sync items during synchronization
Definition: node_impl.hxx:305
fc::time_point _last_firewall_check_message_sent
Definition: node_impl.hxx:291
boost::circular_buffer< uint32_t > _average_network_read_speed_seconds
Definition: node_impl.hxx:401
std::list< potential_peer_record > _add_once_node_list
used by the task that manages connecting to peers
Definition: node_impl.hxx:295
fc::future< void > _fetch_updated_peer_lists_loop_done
Definition: node_impl.hxx:399
std::unordered_set< item_id > _new_inventory
Definition: node_impl.hxx:341
node_configuration _node_configuration
Definition: node_impl.hxx:280
fc::ip::endpoint _actual_listening_endpoint
stores the endpoint we&#39;re listening on. This will be the same as
Definition: node_impl.hxx:285
fc::future< void > _dump_node_status_task_done
Definition: node_impl.hxx:413
boost::circular_buffer< uint32_t > _average_network_read_speed_minutes
Definition: node_impl.hxx:403
An order-perserving dictionary of variant&#39;s.
Definition: api.cpp:56
fc::future< void > _update_seed_nodes_loop_done
Definition: node_impl.hxx:445
microseconds milliseconds(int64_t s)
Definition: time.hpp:35
#define NODE_DELEGATE_METHOD_NAMES
Definition: node_impl.hxx:150
fc::future< void > _process_backlog_of_sync_blocks_done
list of sync blocks we&#39;ve received, but can&#39;t yet process because we are still missing blocks that co...
Definition: node_impl.hxx:316
used by node reports status to client or fetch data from client
Definition: node.hpp:61
fc::future< void > _p2p_network_connect_loop_done
Definition: node_impl.hxx:300
active_sync_requests_map _active_sync_requests
Definition: node_impl.hxx:311
fc::future< void > _advertise_inventory_loop_done
Definition: node_impl.hxx:340
fc::future< void > _bandwidth_monitor_loop_done
Definition: node_impl.hxx:411
items_to_fetch_set_type _items_to_fetch
Definition: node_impl.hxx:333
boost::circular_buffer< uint32_t > _average_network_write_speed_hours
Definition: node_impl.hxx:406
fc::rate_limiting_group _rate_limiter
cache message we have received and might be required to provide to other peers via inventory requests...
Definition: node_impl.hxx:393
std::unordered_set< Key, Hash, Pred >::iterator erase(typename std::unordered_set< Key, Hash, Pred >::const_iterator itr)
Definition: node_impl.hxx:56
std::unordered_set< Key, Hash, Pred >::iterator begin() noexcept
Definition: node_impl.hxx:68
fc::ripemd160 block_id_type
Definition: types.hpp:242
std::unordered_set< Key, Hash, Pred >::local_iterator begin(size_t n)
Definition: node_impl.hxx:78
std::unordered_set< Key, Hash, Pred >::const_iterator begin() const noexcept
Definition: node_impl.hxx:73
void accept(AcceptorType &acc, SocketType &sock)
wraps boost::asio::async_accept
Definition: asio.hpp:251
provides stack-based nullable value similar to boost::optional
Definition: optional.hpp:20
boost::circular_buffer< uint32_t > _average_network_read_speed_hours
Definition: node_impl.hxx:405
boost::container::flat_set< std::string > _seed_nodes
used by the task that checks whether addresses of seed nodes have been updated
Definition: node_impl.hxx:444
std::unordered_set< Key, Hash, Pred >::iterator end() noexcept
Definition: node_impl.hxx:88
mutex
Definition: mutex.hpp:91
fc::future< void > _fetch_sync_items_loop_done
Definition: node_impl.hxx:307
std::list< graphene::net::block_message > _new_received_sync_items
list of sync blocks we&#39;ve asked for from peers but have not yet received
Definition: node_impl.hxx:312
prioritized_item_id(const item_id &item, unsigned sequence_number)
Definition: node_impl.hxx:124
boost::circular_buffer< uint32_t > _average_network_write_speed_seconds
Definition: node_impl.hxx:402
fc::optional< fc::ip::endpoint > _publicly_visible_listening_endpoint
if we&#39;re behind NAT, our listening endpoint address will appear different to the rest of the world...
Definition: node_impl.hxx:290
int64_t count() const
Definition: time.hpp:28
std::pair< typename std::unordered_set< Key, Hash, Pred >::iterator, bool > insert(const Key &val)
Definition: node_impl.hxx:34
#define ilog(FORMAT,...)
Definition: logger.hpp:117
fc::future< void > _terminate_inactive_connections_loop_done
list of items we have received but not yet advertised to our peers
Definition: node_impl.hxx:344
concurrent_unordered_set< graphene::net::peer_connection_ptr > _terminating_connections
Definition: node_impl.hxx:383
std::pair< typename std::unordered_set< Key, Hash, Pred >::iterator, bool > emplace(Key key)
Definition: node_impl.hxx:29
concurrent_unordered_set< graphene::net::peer_connection_ptr > _closing_connections
Definition: node_impl.hxx:381
fc::future< void > _accept_loop_complete
Definition: node_impl.hxx:373
concurrent_unordered_set< graphene::net::peer_connection_ptr > _handshaking_connections
Definition: node_impl.hxx:377
fc::future< void > _delayed_peer_deletion_task_done
Definition: node_impl.hxx:428
firewalled_state _is_firewalled
we determine whether we&#39;re firewalled by asking other nodes. Store the result here: ...
Definition: node_impl.hxx:288
boost::multi_index_container< prioritized_item_id, boost::multi_index::indexed_by< boost::multi_index::ordered_unique< boost::multi_index::identity< prioritized_item_id > >, boost::multi_index::hashed_unique< boost::multi_index::tag< item_id_index >, boost::multi_index::member< prioritized_item_id, item_id,&prioritized_item_id::item >, std::hash< item_id > > > > items_to_fetch_set_type
Definition: node_impl.hxx:331
std::vector< uint32_t > _hard_fork_block_numbers
the number of items we still need to fetch while syncing
Definition: node_impl.hxx:389
std::shared_ptr< peer_connection > peer_connection_ptr
fc::promise< void >::ptr _retrigger_fetch_item_loop_promise
used by the task that fetches items during normal operation
Definition: node_impl.hxx:321
std::unordered_set< Key, Hash, Pred >::const_iterator find(Key key)
Definition: node_impl.hxx:109
bool operator<(const prioritized_item_id &rhs) const
Definition: node_impl.hxx:129
std::unordered_set< Key, Hash, Pred >::const_local_iterator begin(size_t n) const
Definition: node_impl.hxx:83
fc::future< void > _fetch_item_loop_done
Definition: node_impl.hxx:323
Definition: api.hpp:15
fc::promise< void >::ptr _retrigger_advertise_inventory_loop_promise
list of transactions we&#39;ve recently pushed and had rejected by the delegate
Definition: node_impl.hxx:339
boost::circular_buffer< uint32_t > _average_network_write_speed_minutes
Definition: node_impl.hxx:404
static time_point now()
Definition: time.cpp:13
std::list< fc::future< void > > _handle_message_calls_in_progress
Definition: node_impl.hxx:440
boost::multi_index_container< timestamped_item_id, boost::multi_index::indexed_by< boost::multi_index::hashed_unique< boost::multi_index::member< timestamped_item_id, item_id,&timestamped_item_id::item >, std::hash< item_id > >, boost::multi_index::ordered_non_unique< boost::multi_index::tag< timestamp_index >, boost::multi_index::member< timestamped_item_id, fc::time_point_sec,&timestamped_item_id::timestamp > > > > timestamped_items_set_type
fc::ripemd160 transaction_id_type
Definition: types.hpp:244
unsigned _maximum_number_of_sync_blocks_to_prefetch
Definition: node_impl.hxx:437
std::unordered_set< Key, Hash, Pred >::const_iterator end() const noexcept
Definition: node_impl.hxx:93
wraps boost::filesystem::path to provide platform independent path manipulation.
Definition: filesystem.hpp:28
peer_connection::timestamped_items_set_type _recently_failed_items
list of items we know another peer has and we want
Definition: node_impl.hxx:334
std::list< graphene::net::block_message > _received_sync_items
list of sync blocks we&#39;ve just received but haven&#39;t yet tried to process
Definition: node_impl.hxx:313
fc::promise< void >::ptr _retrigger_connect_loop_promise
Definition: node_impl.hxx:298
std::list< peer_connection_ptr > _peers_to_delete
Definition: node_impl.hxx:427
unsigned _maximum_blocks_per_peer_during_syncing
Definition: node_impl.hxx:438
std::unique_ptr< statistics_gathering_node_delegate_wrapper > _delegate
Definition: node_impl.hxx:274
fc::time_point_sec _bandwidth_monitor_last_update_time
Definition: node_impl.hxx:410
boost::circular_buffer< item_hash_t > _most_recent_blocks_accepted
Definition: node_impl.hxx:385
concurrent_unordered_set< graphene::net::peer_connection_ptr > _active_connections
Definition: node_impl.hxx:379
std::unordered_map< graphene::net::block_id_type, fc::time_point > active_sync_requests_map
Definition: node_impl.hxx:309
peer_database _potential_peer_db
list of peers we want to connect to as soon as possible
Definition: node_impl.hxx:297
blockchain_tied_message_cache _message_cache
list of all block numbers where there are hard forks
Definition: node_impl.hxx:391
std::unordered_set< Key, Hash, Pred >::const_local_iterator end(size_t n) const
Definition: node_impl.hxx:103