BitShares-Core  7.0.2
BitShares blockchain node software and command-line wallet software
node_impl.hxx
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2015 Cryptonomex, Inc., and contributors.
3  *
4  * The MIT License
5  *
6  * Permission is hereby granted, free of charge, to any person obtaining a copy
7  * of this software and associated documentation files (the "Software"), to deal
8  * in the Software without restriction, including without limitation the rights
9  * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10  * copies of the Software, and to permit persons to whom the Software is
11  * furnished to do so, subject to the following conditions:
12  *
13  * The above copyright notice and this permission notice shall be included in
14  * all copies or substantial portions of the Software.
15  *
16  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19  * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
22  * THE SOFTWARE.
23  */
24 #pragma once
25 
26 #define P2P_IN_DEDICATED_THREAD
27 
28 //#define ENABLE_DEBUG_ULOGS
29 
30 #ifdef DEFAULT_LOGGER
31 # undef DEFAULT_LOGGER
32 #endif
33 #define DEFAULT_LOGGER "p2p"
34 
35 //log these messages even at warn level when operating on the test network
36 #ifdef GRAPHENE_TEST_NETWORK
37 #define testnetlog wlog
38 #else
39 #define testnetlog(...) do {} while (0)
40 #endif
41 
42 #include <memory>
43 #include <boost/accumulators/accumulators.hpp>
44 #include <boost/accumulators/statistics.hpp>
45 #include <boost/accumulators/statistics/rolling_mean.hpp>
46 #include <fc/thread/thread.hpp>
47 #include <fc/thread/mutex.hpp>
49 #include <fc/log/logger.hpp>
54 #include <graphene/net/node.hpp>
57 
58 namespace graphene { namespace net { namespace detail {
59 
60 namespace bmi = boost::multi_index;
61 
62 /*******
63  * A class to wrap std::unordered_set for multithreading
64  */
65 template <class Key, class Hash = std::hash<Key>, class Pred = std::equal_to<Key> >
66 class concurrent_unordered_set : private std::unordered_set<Key, Hash, Pred>
67 {
68 private:
69  mutable fc::mutex mux;
70 
71 public:
73  fc::mutex& get_mutex()const { return mux; }
74 
77  std::pair< typename std::unordered_set<Key, Hash, Pred>::iterator, bool> emplace( Key key)
78  {
80  return std::unordered_set<Key, Hash, Pred>::emplace( key );
81  }
82  std::pair< typename std::unordered_set<Key, Hash, Pred>::iterator, bool> insert (const Key& val)
83  {
85  return std::unordered_set<Key, Hash, Pred>::insert( val );
86  }
90  size_t size() const
91  {
93  return std::unordered_set<Key, Hash, Pred>::size();
94  }
95  bool empty() const noexcept
96  {
98  return std::unordered_set<Key, Hash, Pred>::empty();
99  }
103  void clear() noexcept
104  {
106  std::unordered_set<Key, Hash, Pred>::clear();
107  }
108  typename std::unordered_set<Key, Hash, Pred>::iterator erase(
109  typename std::unordered_set<Key, Hash, Pred>::const_iterator itr)
110  {
111  fc::scoped_lock<fc::mutex> lock(mux);
112  return std::unordered_set<Key, Hash, Pred>::erase( itr);
113  }
114  size_t erase( const Key& key)
115  {
117  return std::unordered_set<Key, Hash, Pred>::erase( key );
118  }
122  void swap( typename std::unordered_set<Key, Hash, Pred>& other ) noexcept
123  {
125  std::unordered_set<Key, Hash, Pred>::swap( other );
126  }
130  typename std::unordered_set<Key, Hash, Pred>::iterator begin() noexcept
131  {
133  return std::unordered_set<Key, Hash, Pred>::begin();
134  }
135  typename std::unordered_set<Key, Hash, Pred>::const_iterator begin() const noexcept
136  {
138  return std::unordered_set<Key, Hash, Pred>::begin();
139  }
140  typename std::unordered_set<Key, Hash, Pred>::local_iterator begin(size_t n)
141  {
143  return std::unordered_set<Key, Hash, Pred>::begin(n);
144  }
145  typename std::unordered_set<Key, Hash, Pred>::const_local_iterator begin(size_t n) const
146  {
148  return std::unordered_set<Key, Hash, Pred>::begin(n);
149  }
150  typename std::unordered_set<Key, Hash, Pred>::iterator end() noexcept
151  {
153  return std::unordered_set<Key, Hash, Pred>::end();
154  }
155  typename std::unordered_set<Key, Hash, Pred>::const_iterator end() const noexcept
156  {
158  return std::unordered_set<Key, Hash, Pred>::end();
159  }
160  typename std::unordered_set<Key, Hash, Pred>::local_iterator end(size_t n)
161  {
163  return std::unordered_set<Key, Hash, Pred>::end(n);
164  }
165  typename std::unordered_set<Key, Hash, Pred>::const_local_iterator end(size_t n) const
166  {
168  return std::unordered_set<Key, Hash, Pred>::end(n);
169  }
172  typename std::unordered_set<Key, Hash, Pred>::const_iterator find(Key key)
173  {
175  return std::unordered_set<Key, Hash, Pred>::find(key);
176  }
177 };
178 
180 {
181 private:
182  static const uint32_t cache_duration_in_blocks = GRAPHENE_NET_MESSAGE_CACHE_DURATION_IN_BLOCKS;
183 
184  struct message_hash_index{};
185  struct message_contents_hash_index{};
186  struct block_clock_index{};
187  struct message_info
188  {
189  message_hash_type message_hash;
190  message message_body;
191  uint32_t block_clock_when_received;
192 
194  message_propagation_data propagation_data;
197  message_hash_type message_contents_hash;
198 
199  message_info( const message_hash_type& message_hash,
200  const message& message_body,
201  uint32_t block_clock_when_received,
202  const message_propagation_data& propagation_data,
203  message_hash_type message_contents_hash ) :
204  message_hash( message_hash ),
205  message_body( message_body ),
206  block_clock_when_received( block_clock_when_received ),
207  propagation_data( propagation_data ),
208  message_contents_hash( message_contents_hash )
209  {}
210  };
211 
212  using message_cache_container = boost::multi_index_container < message_info,
213  bmi::indexed_by<
214  bmi::ordered_unique< bmi::tag<message_hash_index>,
215  bmi::member<message_info, message_hash_type, &message_info::message_hash> >,
216  bmi::ordered_non_unique< bmi::tag<message_contents_hash_index>,
217  bmi::member<message_info, message_hash_type, &message_info::message_contents_hash> >,
218  bmi::ordered_non_unique< bmi::tag<block_clock_index>,
219  bmi::member<message_info, uint32_t, &message_info::block_clock_when_received> > > >;
220 
221  message_cache_container _message_cache;
222 
223  uint32_t block_clock = 0;
224 
225 public:
226  void block_accepted();
227  void cache_message( const message& message_to_cache,
228  const message_hash_type& hash_of_message_to_cache,
229  const message_propagation_data& propagation_data,
230  const message_hash_type& message_content_hash );
231  message get_message( const message_hash_type& hash_of_message_to_lookup ) const;
233  const message_hash_type& hash_of_msg_contents_to_lookup ) const;
234  size_t size() const { return _message_cache.size(); }
235 };
236 
240 {
244 
246  item(item),
248  timestamp(fc::time_point::now())
249  {}
250  bool operator<(const prioritized_item_id& rhs) const
251  {
253  "block_message_type must be greater than trx_message_type for prioritized_item_ids to sort correctly");
254  if (item.item_type != rhs.item.item_type)
255  return item.item_type > rhs.item.item_type;
256  return rhs.sequence_number > sequence_number;
257  }
258 };
259 
261 {
262  private:
263  std::shared_ptr<node_delegate> _node_delegate;
264  fc::thread *_thread;
265 
266  using call_stats_accumulator = boost::accumulators::accumulator_set< int64_t,
267  boost::accumulators::stats< boost::accumulators::tag::min,
268  boost::accumulators::tag::rolling_mean,
269  boost::accumulators::tag::max,
270  boost::accumulators::tag::sum,
271  boost::accumulators::tag::count> >;
272 #define NODE_DELEGATE_METHOD_NAMES (has_item) \
273  (handle_message) \
274  (handle_block) \
275  (handle_transaction) \
276  (get_block_ids) \
277  (get_item) \
278  (get_chain_id) \
279  (get_blockchain_synopsis) \
280  (sync_status) \
281  (connection_count_changed) \
282  (get_block_number) \
283  (get_block_time) \
284  (get_head_block_id) \
285  (estimate_last_known_fork_from_git_revision_timestamp) \
286  (error_encountered) \
287  (get_current_block_interval_in_seconds)
288 
289 
290 
291 #define DECLARE_ACCUMULATOR(r, data, method_name) \
292  mutable call_stats_accumulator BOOST_PP_CAT(_, BOOST_PP_CAT(method_name, _execution_accumulator)); \
293  mutable call_stats_accumulator BOOST_PP_CAT(_, BOOST_PP_CAT(method_name, _delay_before_accumulator)); \
294  mutable call_stats_accumulator BOOST_PP_CAT(_, BOOST_PP_CAT(method_name, _delay_after_accumulator));
295  BOOST_PP_SEQ_FOR_EACH(DECLARE_ACCUMULATOR, unused, NODE_DELEGATE_METHOD_NAMES)
296 #undef DECLARE_ACCUMULATOR
297 
298  class call_statistics_collector
299  {
300  private:
301  fc::time_point _call_requested_time;
302  fc::time_point _begin_execution_time;
303  fc::time_point _execution_completed_time;
304  const char* _method_name;
305  call_stats_accumulator* _execution_accumulator;
306  call_stats_accumulator* _delay_before_accumulator;
307  call_stats_accumulator* _delay_after_accumulator;
308  public:
310  {
311  std::shared_ptr<call_statistics_collector> _collector;
312  public:
313  explicit actual_execution_measurement_helper(std::shared_ptr<call_statistics_collector> collector) :
314  _collector(collector)
315  {
316  _collector->starting_execution();
317  }
319  {
320  _collector->execution_completed();
321  }
322  };
323  call_statistics_collector(const char* method_name,
324  call_stats_accumulator* execution_accumulator,
325  call_stats_accumulator* delay_before_accumulator,
326  call_stats_accumulator* delay_after_accumulator) :
327  _call_requested_time(fc::time_point::now()),
328  _method_name(method_name),
329  _execution_accumulator(execution_accumulator),
330  _delay_before_accumulator(delay_before_accumulator),
331  _delay_after_accumulator(delay_after_accumulator)
332  {}
333  ~call_statistics_collector()
334  {
336  fc::microseconds actual_execution_time(_execution_completed_time - _begin_execution_time);
337  fc::microseconds delay_before(_begin_execution_time - _call_requested_time);
338  fc::microseconds delay_after(end_time - _execution_completed_time);
339  fc::microseconds total_duration(actual_execution_time + delay_before + delay_after);
340  (*_execution_accumulator)(actual_execution_time.count());
341  (*_delay_before_accumulator)(delay_before.count());
342  (*_delay_after_accumulator)(delay_after.count());
343  if (total_duration > fc::milliseconds(500))
344  {
345  dlog("Call to method node_delegate::${method} took ${total_duration}us, longer than our target maximum of 500ms",
346  ("method", _method_name)
347  ("total_duration", total_duration.count()));
348  dlog("Actual execution took ${execution_duration}us, with a ${delegate_delay}us delay before the delegate thread started "
349  "executing the method, and a ${p2p_delay}us delay after it finished before the p2p thread started processing the response",
350  ("execution_duration", actual_execution_time)
351  ("delegate_delay", delay_before)
352  ("p2p_delay", delay_after));
353  }
354  }
355  void starting_execution()
356  {
357  _begin_execution_time = fc::time_point::now();
358  }
359  void execution_completed()
360  {
361  _execution_completed_time = fc::time_point::now();
362  }
363  };
364  public:
365  statistics_gathering_node_delegate_wrapper(std::shared_ptr<node_delegate> delegate,
366  fc::thread* thread_for_delegate_calls);
367 
369 
370  bool has_item( const graphene::net::item_id& id ) override;
371  void handle_message( const message& ) override;
372  bool handle_block( const graphene::net::block_message& block_message, bool sync_mode,
373  std::vector<message_hash_type>& contained_transaction_msg_ids ) override;
374  void handle_transaction( const graphene::net::trx_message& transaction_message ) override;
375  std::vector<item_hash_t> get_block_ids(const std::vector<item_hash_t>& blockchain_synopsis,
376  uint32_t& remaining_item_count,
377  uint32_t limit = 2000) override;
378  message get_item( const item_id& id ) override;
380  std::vector<item_hash_t> get_blockchain_synopsis(const item_hash_t& reference_point,
381  uint32_t number_of_blocks_after_reference_point) override;
382  void sync_status( uint32_t item_type, uint32_t item_count ) override;
383  void connection_count_changed( uint32_t c ) override;
384  uint32_t get_block_number(const item_hash_t& block_id) override;
385  fc::time_point_sec get_block_time(const item_hash_t& block_id) override;
386  item_hash_t get_head_block_id() const override;
387  uint32_t estimate_last_known_fork_from_git_revision_timestamp(uint32_t unix_timestamp) const override;
388  void error_encountered(const std::string& message, const fc::oexception& error) override;
389  uint8_t get_current_block_interval_in_seconds() const override;
390 };
391 
395 {
399  bool connect_to_new_peers = true;
408 };
409 
410 class node_impl : public peer_connection_delegate, public std::enable_shared_from_this<node_impl>
411 {
412 public:
414  {
415  public:
416  static std::shared_ptr<address_builder> create_default_address_builder();
417  void build( node_impl* impl, address_message& ) const;
418  virtual bool should_advertise(const fc::ip::endpoint& in ) const = 0;
419  virtual ~address_builder() = default;
420  };
421 
422 #ifdef P2P_IN_DEDICATED_THREAD
423  std::shared_ptr<fc::thread> _thread = std::make_shared<fc::thread>("p2p");
424  std::shared_ptr<fc::thread> get_thread() const { return _thread; }
425 #endif // P2P_IN_DEDICATED_THREAD
426  std::unique_ptr<statistics_gathering_node_delegate_wrapper> _delegate;
428 
429 #define NODE_CONFIGURATION_FILENAME "node_config.json"
430 #define POTENTIAL_PEER_DATABASE_FILENAME "peers.json"
433 
438  // Note: updating the type to optional may break 3rd-party client applications.
440 
444  std::list<potential_peer_record> _add_once_node_list;
445 
451 
457 
458  typedef std::unordered_map<graphene::net::block_id_type, fc::time_point> active_sync_requests_map;
459 
463  std::list<graphene::net::block_message> _new_received_sync_items;
466  std::list<graphene::net::block_message> _received_sync_items;
468 
471 
477 
478  struct item_id_index{};
479  using items_to_fetch_set_type = boost::multi_index_container< prioritized_item_id,
480  boost::multi_index::indexed_by<
481  boost::multi_index::ordered_unique< boost::multi_index::identity<prioritized_item_id> >,
482  boost::multi_index::hashed_unique<
483  boost::multi_index::tag<item_id_index>,
484  boost::multi_index::member<prioritized_item_id, item_id, &prioritized_item_id::item>,
485  std::hash<item_id>
486  >
487  >
488  >;
496 
504 
508 
509  std::string _user_agent_string;
525 
534 
537 
549 
551  boost::circular_buffer<item_hash_t> _most_recent_blocks_accepted { _maximum_number_of_connections };
552 
553  uint32_t _sync_item_type = 0;
557  std::vector<uint32_t> _hard_fork_block_numbers;
558 
561 
563 
566 
568 
570 
572  boost::circular_buffer<uint32_t> _avg_net_read_speed_seconds { 60 };
574  boost::circular_buffer<uint32_t> _avg_net_write_speed_seconds { 60 };
576  boost::circular_buffer<uint32_t> _avg_net_read_speed_minutes { 60 };
578  boost::circular_buffer<uint32_t> _avg_net_write_speed_minutes { 60 };
580  boost::circular_buffer<uint32_t> _avg_net_read_speed_hours { 72 };
582  boost::circular_buffer<uint32_t> _avg_net_write_speed_hours { 72 };
587 
590 
592 
602 //#define USE_PEERS_TO_DELETE_MUTEX 1
604 #ifdef USE_PEERS_TO_DELETE_MUTEX
605  fc::mutex _peers_to_delete_mutex;
606 #endif
607  std::list<peer_connection_ptr> _peers_to_delete;
610 
611 #ifdef ENABLE_P2P_DEBUGGING_API
612  std::set<node_id_t> _allowed_peers;
613 #endif // ENABLE_P2P_DEBUGGING_API
614 
618 
627 
628  std::list<fc::future<void> > _handle_message_calls_in_progress;
629 
632  boost::container::flat_set<std::string> _seed_nodes;
634  void update_seed_nodes_task();
637 
638  explicit node_impl(const std::string& user_agent);
639  ~node_impl() override;
640 
642 
645 
646  bool have_already_received_sync_item( const item_hash_t& item_hash );
647  void request_sync_item_from_peer( const peer_connection_ptr& peer, const item_hash_t& item_to_request );
648  void request_sync_items_from_peer( const peer_connection_ptr& peer, const std::vector<item_hash_t>& items_to_request );
649  void fetch_sync_items_loop();
651 
652  bool is_item_in_any_peers_inventory(const item_id& item) const;
653  void fetch_items_loop();
655 
658 
660 
662  void update_bandwidth_data(uint32_t bytes_read_this_second, uint32_t bytes_written_this_second);
663  void bandwidth_monitor_loop();
664  void dump_node_status_task();
665 
668  uint32_t get_number_of_connections();
670 
671  bool merge_address_info_with_potential_peer_database( const std::vector<address_info> addresses );
674  std::vector<item_hash_t> create_blockchain_synopsis_for_peer( const peer_connection* peer );
675  void fetch_next_batch_of_item_ids_from_peer( peer_connection* peer, bool reset_fork_tracking_data_for_peer = false );
676 
678  void parse_hello_user_data_for_peer( peer_connection* originating_peer, const fc::variant_object& user_data );
679 
680  void on_message( peer_connection* originating_peer,
681  const message& received_message ) override;
682 
683  void on_hello_message( peer_connection* originating_peer,
684  const hello_message& hello_message_received );
685 
686  void on_connection_accepted_message( peer_connection* originating_peer,
687  const connection_accepted_message& ) const;
688 
689  void on_connection_rejected_message( peer_connection* originating_peer,
690  const connection_rejected_message& connection_rejected_message_received );
691 
692  void on_address_request_message( peer_connection* originating_peer, const address_request_message&);
693 
694  void on_address_message( peer_connection* originating_peer,
695  const address_message& address_message_received );
696 
698  const fetch_blockchain_item_ids_message& fetch_blockchain_item_ids_message_received );
699 
701  const blockchain_item_ids_inventory_message& blockchain_item_ids_inventory_message_received );
702 
703  void on_fetch_items_message( peer_connection* originating_peer,
704  const fetch_items_message& fetch_items_message_received );
705 
706  void on_item_not_available_message( peer_connection* originating_peer,
707  const item_not_available_message& item_not_available_message_received );
708 
709  void on_item_ids_inventory_message( peer_connection* originating_peer,
710  const item_ids_inventory_message& item_ids_inventory_message_received );
711 
712  void on_closing_connection_message( peer_connection* originating_peer,
713  const closing_connection_message& closing_connection_message_received );
714 
715  void on_current_time_request_message( peer_connection* originating_peer,
716  const current_time_request_message& current_time_request_message_received );
717 
718  void on_current_time_reply_message( peer_connection* originating_peer,
719  const current_time_reply_message& current_time_reply_message_received );
720 
721  void on_connection_closed(peer_connection* originating_peer) override;
722 
723  void send_sync_block_to_node_delegate(const graphene::net::block_message& block_message_to_send);
727  peer_connection* originating_peer,
729  const message_hash_type& message_hash);
731  peer_connection* originating_peer,
733  const message_hash_type& message_hash);
735  peer_connection* originating_peer,
736  const message& message_to_process,
737  const message_hash_type& message_hash);
738 
740  peer_connection* originating_peer,
741  const message& message_to_process,
742  const message_hash_type& message_hash);
743 
744  void start_synchronizing();
746 
748  void new_peer_just_added(const peer_connection_ptr& peer);
749 
750  void close();
751 
753  void accept_loop();
754  void send_hello_message(const peer_connection_ptr& peer);
755  void connect_to_task(peer_connection_ptr new_peer, const fc::ip::endpoint& remote_endpoint);
756  bool is_connected_to_endpoint(const fc::ip::endpoint& remote_endpoint) const;
757 
761 
762  /***
763  * Look for an active connection at the given address
764  * @param remote_endpoint the address we are interested in
765  * @returns the connection, or peer_connection_ptr() if not found
766  */
767  peer_connection_ptr get_active_conn_for_endpoint( const fc::ip::endpoint& remote_endpoint ) const;
768  /***
769  * Look for a connection that is either active or currently in the handshaking process
770  * @param remote_endpoint the address we are interested in
771  * @returns the connection, or peer_connection_ptr() if not found
772  */
773  peer_connection_ptr get_connection_for_endpoint( const fc::ip::endpoint& remote_endpoint ) const;
774 
775  void dump_node_status();
776 
778  void schedule_peer_for_deletion(const peer_connection_ptr& peer_to_delete);
779 
780  void disconnect_from_peer( peer_connection* originating_peer,
781  const std::string& reason_for_disconnect,
782  bool caused_by_error = false,
783  const fc::oexception& additional_data = fc::oexception() );
784 
785  // methods implementing node's public interface
786  void set_node_delegate(std::shared_ptr<node_delegate> del, fc::thread* thread_for_delegate_calls);
787  void load_configuration( const fc::path& configuration_directory );
788  void listen_to_p2p_network();
790  void add_node( const fc::ip::endpoint& ep );
791  void set_advertise_algorithm( const std::string& algo,
792  const std::vector<std::string>& advertise_or_exclude_list );
793  void add_seed_node( const std::string& seed_string );
794  void resolve_seed_node_and_add( const std::string& seed_string );
795  void initiate_connect_to(const peer_connection_ptr& peer);
796  void connect_to_endpoint(const fc::ip::endpoint& ep);
797  void set_listen_endpoint(const fc::ip::endpoint& ep , bool wait_if_not_available);
798  void set_inbound_endpoint( const fc::ip::endpoint& ep );
800  void set_connect_to_new_peers( bool connect );
801 
803  std::vector<peer_status> get_connected_peers() const;
804  uint32_t get_connection_count() const;
805 
806  void broadcast(const message& item_to_broadcast, const message_propagation_data& propagation_data);
807  void broadcast(const message& item_to_broadcast);
808  void sync_from(const item_id& current_head_block, const std::vector<uint32_t>& hard_fork_block_numbers);
809  bool is_connected() const;
810  std::vector<potential_peer_record> get_potential_peers() const;
811  void set_advanced_node_parameters( const fc::variant_object& params );
812 
815  const graphene::net::transaction_id_type& transaction_id ) const;
817 
818  node_id_t get_node_id() const;
819  void set_allowed_peers( const std::vector<node_id_t>& allowed_peers );
820  void clear_peer_database();
821  void set_total_bandwidth_limit( uint32_t upload_bytes_per_second,
822  uint32_t download_bytes_per_second );
825 
828 
829  bool is_hard_fork_block(uint32_t block_number) const;
830  uint32_t get_next_known_hard_fork_block_number(uint32_t block_number) const;
831  }; // end class node_impl
832 
834  {
835  void operator()(node_impl*);
836  };
837 
838 }}} // end of namespace graphene::net::detail
839 
841  (listen_endpoint)
842  (inbound_endpoint)
843  (accept_incoming_connections)
844  (connect_to_new_peers)
845  (wait_if_endpoint_is_busy)
846  (private_key) )
graphene::net::detail::node_impl::save_node_configuration
void save_node_configuration()
Definition: node.cpp:336
graphene::net::detail::node_impl::set_accept_incoming_connections
void set_accept_incoming_connections(bool accept)
Definition: node.cpp:4753
fc::promise
Definition: future.hpp:109
graphene::net::detail::node_impl::is_connected_to_endpoint
bool is_connected_to_endpoint(const fc::ip::endpoint &remote_endpoint) const
Definition: node.cpp:4586
graphene::net::detail::statistics_gathering_node_delegate_wrapper::statistics_gathering_node_delegate_wrapper
statistics_gathering_node_delegate_wrapper(std::shared_ptr< node_delegate > delegate, fc::thread *thread_for_delegate_calls)
Definition: node.cpp:5238
graphene::net::detail::node_impl::on_blockchain_item_ids_inventory_message
void on_blockchain_item_ids_inventory_message(peer_connection *originating_peer, const blockchain_item_ids_inventory_message &blockchain_item_ids_inventory_message_received)
Definition: node.cpp:2331
graphene::net::block_message
Definition: core_messages.hpp:104
graphene::net::detail::concurrent_unordered_set::insert
std::pair< typename std::unordered_set< Key, Hash, Pred >::iterator, bool > insert(const Key &val)
Definition: node_impl.hxx:84
graphene::net::detail::statistics_gathering_node_delegate_wrapper::get_chain_id
graphene::protocol::chain_id_type get_chain_id() const override
Definition: node.cpp:5365
graphene::net::detail::node_impl::close
void close()
Definition: node.cpp:3698
fc::milliseconds
microseconds milliseconds(int64_t s)
Definition: time.hpp:35
graphene::net::detail::node_impl::start_synchronizing
void start_synchronizing()
Definition: node.cpp:3672
fc::variant_object
An order-perserving dictionary of variant's.
Definition: variant_object.hpp:20
graphene::net::detail::node_impl::_avg_net_usage_minute_counter
size_t _avg_net_usage_minute_counter
Average network usage minute counter.
Definition: node_impl.hxx:586
graphene::net::detail::node_impl::set_inbound_endpoint
void set_inbound_endpoint(const fc::ip::endpoint &ep)
Definition: node.cpp:4746
graphene::net::detail::node_impl_deleter::operator()
void operator()(node_impl *)
Definition: node.cpp:129
graphene::net::detail::node_impl::is_connected
bool is_connected() const
Definition: node.cpp:4892
graphene::net::detail::node_impl::trigger_fetch_items_loop
void trigger_fetch_items_loop()
Definition: node.cpp:759
graphene::net::detail::node_impl::_sync_item_type
uint32_t _sync_item_type
Definition: node_impl.hxx:553
graphene::net::detail::statistics_gathering_node_delegate_wrapper::get_blockchain_synopsis
std::vector< item_hash_t > get_blockchain_synopsis(const item_hash_t &reference_point, uint32_t number_of_blocks_after_reference_point) override
Definition: node.cpp:5370
graphene::net::detail::node_impl::get_next_known_hard_fork_block_number
uint32_t get_next_known_hard_fork_block_number(uint32_t block_number) const
Definition: node.cpp:5048
graphene::net::detail::node_impl::p2p_network_connect_loop
void p2p_network_connect_loop()
Definition: node.cpp:359
graphene::net::detail::node_impl::is_accepting_new_connections
bool is_accepting_new_connections()
Definition: node.cpp:1269
graphene::net::detail::node_impl::request_sync_items_from_peer
void request_sync_items_from_peer(const peer_connection_ptr &peer, const std::vector< item_hash_t > &items_to_request)
Definition: node.cpp:527
graphene::net::detail::node_impl::on_current_time_request_message
void on_current_time_request_message(peer_connection *originating_peer, const current_time_request_message &current_time_request_message_received)
Definition: node.cpp:3545
graphene::net::detail::node_impl::_received_sync_items
std::list< graphene::net::block_message > _received_sync_items
Definition: node_impl.hxx:466
graphene::net::detail::node_impl::address_builder::should_advertise
virtual bool should_advertise(const fc::ip::endpoint &in) const =0
graphene::net::detail::node_impl::trigger_p2p_network_connect_loop
void trigger_p2p_network_connect_loop()
Definition: node.cpp:458
graphene::net::detail::node_impl::_new_received_sync_items
std::list< graphene::net::block_message > _new_received_sync_items
List of sync blocks we've just received but haven't yet tried to process.
Definition: node_impl.hxx:463
graphene::net::detail::node_impl::on_message
void on_message(peer_connection *originating_peer, const message &received_message) override
Definition: node.cpp:1369
graphene::net::peer_database
Definition: peer_database.hpp:95
graphene::net::detail::node_impl::_fetch_updated_peer_lists_loop_done
fc::future< void > _fetch_updated_peer_lists_loop_done
Definition: node_impl.hxx:569
fc::mutex
mutex
Definition: mutex.hpp:91
graphene::net::detail::node_impl::_dump_node_status_task_done
fc::future< void > _dump_node_status_task_done
Definition: node_impl.hxx:591
graphene::net::detail::node_impl::connect_to_p2p_network
void connect_to_p2p_network(node_impl_ptr self)
Definition: node.cpp:4380
fc::scoped_lock
Definition: scoped_lock.hpp:5
graphene::net::detail::node_impl::get_connection_count
uint32_t get_connection_count() const
Definition: node.cpp:4846
graphene::net::detail::node_impl::_fetch_item_loop_done
fc::future< void > _fetch_item_loop_done
Definition: node_impl.hxx:476
graphene::net::detail::node_impl::on_item_ids_inventory_message
void on_item_ids_inventory_message(peer_connection *originating_peer, const item_ids_inventory_message &item_ids_inventory_message_received)
Definition: node.cpp:2767
graphene::net::detail::node_impl::_accept_loop_complete
fc::future< void > _accept_loop_complete
Definition: node_impl.hxx:536
graphene::net::detail::node_impl::update_bandwidth_data
void update_bandwidth_data(uint32_t bytes_read_this_second, uint32_t bytes_written_this_second)
Definition: node.cpp:1135
GRAPHENE_MAX_BLOCK_INTERVAL
#define GRAPHENE_MAX_BLOCK_INTERVAL
Definition: config.hpp:60
graphene::net::detail::node_impl::_most_recent_blocks_accepted
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)
Definition: node_impl.hxx:551
GRAPHENE_NET_MAX_BLOCKS_PER_PEER_DURING_SYNCING
#define GRAPHENE_NET_MAX_BLOCKS_PER_PEER_DURING_SYNCING
Definition: config.hpp:87
graphene::net::detail::node_impl::_kill_inactive_conns_loop_done
fc::future< void > _kill_inactive_conns_loop_done
Definition: node_impl.hxx:505
graphene::net::block_message_type
@ block_message_type
Definition: core_messages.hpp:69
graphene::protocol::transaction_id_type
fc::ripemd160 transaction_id_type
Definition: types.hpp:306
graphene::net::detail::node_impl::_delayed_peer_deletion_task_done
fc::future< void > _delayed_peer_deletion_task_done
Definition: node_impl.hxx:608
graphene::net::detail::concurrent_unordered_set::begin
std::unordered_set< Key, Hash, Pred >::iterator begin() noexcept
Definition: node_impl.hxx:132
graphene::net::detail::statistics_gathering_node_delegate_wrapper::get_current_block_interval_in_seconds
uint8_t get_current_block_interval_in_seconds() const override
Definition: node.cpp:5412
graphene::net::address_message
Definition: core_messages.hpp:298
node.hpp
graphene::net::detail::node_impl::get_tx_propagation_data
message_propagation_data get_tx_propagation_data(const graphene::net::transaction_id_type &transaction_id) const
Definition: node.cpp:4948
graphene::net::detail::blockchain_tied_message_cache::get_message
message get_message(const message_hash_type &hash_of_message_to_lookup) const
Definition: node.cpp:107
graphene::net::detail::node_impl::fetch_sync_items_loop
void fetch_sync_items_loop()
Definition: node.cpp:541
graphene::net::detail::node_impl::get_block_propagation_data
message_propagation_data get_block_propagation_data(const graphene::net::block_id_type &block_id) const
Definition: node.cpp:4955
graphene::net::detail::statistics_gathering_node_delegate_wrapper::get_block_ids
std::vector< item_hash_t > get_block_ids(const std::vector< item_hash_t > &blockchain_synopsis, uint32_t &remaining_item_count, uint32_t limit=2000) override
Definition: node.cpp:5353
graphene::net::detail::node_impl::get_call_statistics
fc::variant_object get_call_statistics() const
Definition: node.cpp:4998
graphene::net::detail::node_impl::get_actual_listening_endpoint
fc::ip::endpoint get_actual_listening_endpoint() const
Definition: node.cpp:4767
graphene::net::blockchain_item_ids_inventory_message
Definition: core_messages.hpp:131
fc
Definition: api.hpp:15
graphene::net::detail::node_impl::on_hello_message
void on_hello_message(peer_connection *originating_peer, const hello_message &hello_message_received)
Definition: node.cpp:1513
graphene::net::detail::concurrent_unordered_set::end
std::unordered_set< Key, Hash, Pred >::iterator end() noexcept
Definition: node_impl.hxx:152
graphene::net::detail::node_impl::generate_hello_user_data
fc::variant_object generate_hello_user_data()
Definition: node.cpp:1454
NODE_DELEGATE_METHOD_NAMES
#define NODE_DELEGATE_METHOD_NAMES
Definition: node_impl.hxx:272
graphene::net::detail::node_impl::_recently_failed_items
peer_connection::timestamped_items_set_type _recently_failed_items
List of transactions we've recently pushed and had rejected by the delegate.
Definition: node_impl.hxx:494
graphene::net::detail::node_impl::disconnect_from_peer
void disconnect_from_peer(peer_connection *originating_peer, const std::string &reason_for_disconnect, bool caused_by_error=false, const fc::oexception &additional_data=fc::oexception())
Definition: node.cpp:4679
graphene::net::detail::node_impl::parse_hello_user_data_for_peer
void parse_hello_user_data_for_peer(peer_connection *originating_peer, const fc::variant_object &user_data)
Definition: node.cpp:1489
graphene::net::message
Definition: message.hpp:58
graphene::net::detail::concurrent_unordered_set
Definition: node_impl.hxx:66
graphene::net::detail::node_impl::set_total_bandwidth_limit
void set_total_bandwidth_limit(uint32_t upload_bytes_per_second, uint32_t download_bytes_per_second)
Definition: node.cpp:4991
graphene::net::detail::node_impl::fetch_next_batch_of_item_ids_from_peer
void fetch_next_batch_of_item_ids_from_peer(peer_connection *peer, bool reset_fork_tracking_data_for_peer=false)
Definition: node.cpp:2300
scoped_lock.hpp
graphene::net::detail::node_impl::active_sync_requests_map
std::unordered_map< graphene::net::block_id_type, fc::time_point > active_sync_requests_map
Definition: node_impl.hxx:458
graphene::net::detail::node_impl::calculate_unsynced_block_count_from_all_peers
uint32_t calculate_unsynced_block_count_from_all_peers()
Definition: node.cpp:2230
graphene::net::detail::blockchain_tied_message_cache::cache_message
void cache_message(const message &message_to_cache, const message_hash_type &hash_of_message_to_cache, const message_propagation_data &propagation_data, const message_hash_type &message_content_hash)
Definition: node.cpp:95
graphene::net::detail::prioritized_item_id::operator<
bool operator<(const prioritized_item_id &rhs) const
Definition: node_impl.hxx:250
graphene::net::detail::node_impl::fetch_items_loop
void fetch_items_loop()
Definition: node.cpp:630
fc::sha256
Definition: sha256.hpp:10
GRAPHENE_NET_DEFAULT_MAX_CONNECTIONS
#define GRAPHENE_NET_DEFAULT_MAX_CONNECTIONS
Definition: config.hpp:61
graphene::net::detail::node_impl::item_id_index
Definition: node_impl.hxx:478
graphene::net::node_impl_ptr
std::shared_ptr< detail::node_impl > node_impl_ptr
Definition: node.hpp:41
graphene::net::detail::statistics_gathering_node_delegate_wrapper
Definition: node_impl.hxx:260
graphene::net::detail::concurrent_unordered_set::clear
void clear() noexcept
Definition: node_impl.hxx:105
graphene::net::detail::node_impl::get_connection_for_endpoint
peer_connection_ptr get_connection_for_endpoint(const fc::ip::endpoint &remote_endpoint) const
Definition: node.cpp:4562
graphene::net::detail::statistics_gathering_node_delegate_wrapper::get_block_time
fc::time_point_sec get_block_time(const item_hash_t &block_id) override
Definition: node.cpp:5392
graphene::net::detail::blockchain_tied_message_cache::get_message_propagation_data
message_propagation_data get_message_propagation_data(const message_hash_type &hash_of_msg_contents_to_lookup) const
Definition: node.cpp:116
graphene::net::detail::statistics_gathering_node_delegate_wrapper::get_call_statistics
fc::variant_object get_call_statistics()
Definition: node.cpp:5246
fc::zero_initialized_array< unsigned char, 33 >
graphene::net::detail::node_configuration::private_key
fc::ecc::private_key private_key
Definition: node_impl.hxx:407
graphene::net::detail::node_impl::_update_seed_nodes_loop_done
fc::future< void > _update_seed_nodes_loop_done
Definition: node_impl.hxx:633
graphene::net::detail::node_impl::_address_builder
std::shared_ptr< address_builder > _address_builder
Definition: node_impl.hxx:567
graphene::net::detail::node_configuration::inbound_endpoint
fc::optional< fc::ip::endpoint > inbound_endpoint
Definition: node_impl.hxx:397
graphene::net::detail::node_impl::_tcp_server
fc::tcp_server _tcp_server
Definition: node_impl.hxx:535
graphene::net::detail::node_configuration
Definition: node_impl.hxx:394
graphene::net::detail::node_impl::clear_peer_database
void clear_peer_database()
Definition: node.cpp:4985
graphene::net::detail::node_impl::process_ordinary_message
void process_ordinary_message(peer_connection *originating_peer, const message &message_to_process, const message_hash_type &message_hash)
Definition: node.cpp:3576
graphene::net::detail::concurrent_unordered_set::emplace
std::pair< typename std::unordered_set< Key, Hash, Pred >::iterator, bool > emplace(Key key)
Definition: node_impl.hxx:79
graphene::net::item_hash_t
fc::ripemd160 item_hash_t
Definition: core_messages.hpp:48
MAX_BLOCKS_TO_HANDLE_AT_ONCE
constexpr size_t MAX_BLOCKS_TO_HANDLE_AT_ONCE
Definition: config.hpp:118
graphene::net::detail::node_impl::on_address_message
void on_address_message(peer_connection *originating_peer, const address_message &address_message_received)
Definition: node.cpp:2021
graphene::net::detail::statistics_gathering_node_delegate_wrapper::connection_count_changed
void connection_count_changed(uint32_t c) override
Definition: node.cpp:5380
graphene::net::detail::node_impl::on_connection_accepted_message
void on_connection_accepted_message(peer_connection *originating_peer, const connection_accepted_message &) const
Definition: node.cpp:1884
DECLARE_ACCUMULATOR
#define DECLARE_ACCUMULATOR(r, data, method_name)
Definition: node_impl.hxx:291
graphene::net::detail::node_impl::schedule_peer_for_deletion
void schedule_peer_for_deletion(const peer_connection_ptr &peer_to_delete)
Definition: node.cpp:1219
graphene::net::detail::node_impl::_handshaking_connections
concurrent_unordered_set< graphene::net::peer_connection_ptr > _handshaking_connections
Definition: node_impl.hxx:540
graphene::net::detail::node_impl::_max_addrs_to_handle_at_once
size_t _max_addrs_to_handle_at_once
Maximum number of addresses to handle at one time.
Definition: node_impl.hxx:620
graphene::net::detail::node_impl::add_node
void add_node(const fc::ip::endpoint &ep)
Definition: node.cpp:4413
graphene::net::detail::node_impl::_items_to_fetch_seq_counter
size_t _items_to_fetch_seq_counter
Items to fetch sequence counter.
Definition: node_impl.hxx:490
graphene::net::detail::node_impl::delayed_peer_deletion_task
void delayed_peer_deletion_task()
Definition: node.cpp:1199
core_messages.hpp
graphene::net::detail::node_impl::_node_is_shutting_down
bool _node_is_shutting_down
Definition: node_impl.hxx:617
graphene::net::address_request_message
Definition: core_messages.hpp:263
graphene::net::detail::node_impl::start_synchronizing_with_peer
void start_synchronizing_with_peer(const peer_connection_ptr &peer)
Definition: node.cpp:3660
graphene::net::detail::node_impl::_terminating_connections
concurrent_unordered_set< graphene::net::peer_connection_ptr > _terminating_connections
Definition: node_impl.hxx:548
graphene::net::detail::node_impl::load_configuration
void load_configuration(const fc::path &configuration_directory)
Definition: node.cpp:4202
graphene::net::detail::node_impl::_retrigger_fetch_item_loop_promise
fc::promise< void >::ptr _retrigger_fetch_item_loop_promise
Definition: node_impl.hxx:474
graphene::net::detail::node_impl::get_node_id
node_id_t get_node_id() const
Definition: node.cpp:4962
graphene::net::detail::node_impl::_bandwidth_monitor_loop_done
fc::future< void > _bandwidth_monitor_loop_done
Definition: node_impl.hxx:589
graphene::net::detail::node_impl::get_advanced_node_parameters
fc::variant_object get_advanced_node_parameters()
Definition: node.cpp:4934
graphene::net::detail::node_configuration::accept_incoming_connections
bool accept_incoming_connections
Definition: node_impl.hxx:398
graphene::net::detail::prioritized_item_id::timestamp
fc::time_point timestamp
the time we last heard about this item in an inventory message
Definition: node_impl.hxx:243
fc::ip::endpoint
Definition: ip.hpp:65
fc::ecc::private_key
an elliptic curve private key.
Definition: elliptic.hpp:89
graphene::net::detail::node_impl::_delegate
std::unique_ptr< statistics_gathering_node_delegate_wrapper > _delegate
Definition: node_impl.hxx:426
graphene::net::detail::node_impl::initiate_connect_to
void initiate_connect_to(const peer_connection_ptr &peer)
Definition: node.cpp:4502
graphene::net::connection_rejected_message
Definition: core_messages.hpp:241
graphene::net::detail::node_impl::send_hello_message
void send_hello_message(const peer_connection_ptr &peer)
Definition: node.cpp:4054
graphene::net::detail::node_impl::is_wanting_new_connections
bool is_wanting_new_connections()
Definition: node.cpp:1276
graphene::net::detail::prioritized_item_id::prioritized_item_id
prioritized_item_id(const item_id &item, size_t sequence_number)
Definition: node_impl.hxx:245
graphene::net::detail::statistics_gathering_node_delegate_wrapper::handle_block
bool handle_block(const graphene::net::block_message &block_message, bool sync_mode, std::vector< message_hash_type > &contained_transaction_msg_ids) override
Called when a new block comes in from the network.
Definition: node.cpp:5342
graphene::net::detail::concurrent_unordered_set::size
size_t size() const
Definition: node_impl.hxx:92
graphene::net::detail::node_impl::on_fetch_blockchain_item_ids_message
void on_fetch_blockchain_item_ids_message(peer_connection *originating_peer, const fetch_blockchain_item_ids_message &fetch_blockchain_item_ids_message_received)
Definition: node.cpp:2104
graphene::net::current_time_request_message
Definition: core_messages.hpp:323
graphene::net::detail::node_impl::_rate_limiter
fc::rate_limiting_group _rate_limiter
Definition: node_impl.hxx:562
graphene::net::detail::node_impl::_peer_connection_retry_timeout
uint32_t _peer_connection_retry_timeout
Definition: node_impl.hxx:531
graphene::net::detail::node_impl::process_block_message
void process_block_message(peer_connection *originating_peer, const message &message_to_process, const message_hash_type &message_hash)
Definition: node.cpp:3464
graphene::net::detail::node_impl::create_blockchain_synopsis_for_peer
std::vector< item_hash_t > create_blockchain_synopsis_for_peer(const peer_connection *peer)
Definition: node.cpp:2249
graphene::net::detail::node_impl::trigger_process_backlog_of_sync_blocks
void trigger_process_backlog_of_sync_blocks()
Definition: node.cpp:3281
graphene::net::item_id
Definition: core_messages.hpp:49
graphene::net::hello_message
Definition: core_messages.hpp:189
graphene::net::detail::node_impl::set_listen_endpoint
void set_listen_endpoint(const fc::ip::endpoint &ep, bool wait_if_not_available)
Definition: node.cpp:4738
rate_limiting.hpp
graphene::net::detail::node_impl::_max_sync_blocks_per_peer
size_t _max_sync_blocks_per_peer
Maximum number of blocks per peer during syncing.
Definition: node_impl.hxx:626
graphene::net::detail::node_impl::update_seed_nodes_task
void update_seed_nodes_task()
Definition: node.cpp:467
graphene::net::detail::node_impl::dump_node_status
void dump_node_status()
Definition: node.cpp:4619
types.hpp
graphene::net::detail::node_impl::set_connect_to_new_peers
void set_connect_to_new_peers(bool connect)
Definition: node.cpp:4760
graphene::net::detail::node_impl::_process_backlog_of_sync_blocks_done
fc::future< void > _process_backlog_of_sync_blocks_done
Definition: node_impl.hxx:469
graphene::net::detail::node_impl::_potential_peer_db_updated
bool _potential_peer_db_updated
Definition: node_impl.hxx:448
graphene::net::detail::node_impl::_new_inventory
concurrent_unordered_set< item_id > _new_inventory
List of items we have received but not yet advertised to our peers.
Definition: node_impl.hxx:502
fc::path
wraps boost::filesystem::path to provide platform independent path manipulation.
Definition: filesystem.hpp:28
graphene::net::fetch_items_message
Definition: core_messages.hpp:163
graphene::net::detail::node_impl::_closing_connections
concurrent_unordered_set< graphene::net::peer_connection_ptr > _closing_connections
Definition: node_impl.hxx:545
graphene::net::detail::node_impl::_active_sync_requests
active_sync_requests_map _active_sync_requests
List of sync blocks we've asked for from peers but have not yet received.
Definition: node_impl.hxx:461
GRAPHENE_NET_PEER_HANDSHAKE_INACTIVITY_TIMEOUT
#define GRAPHENE_NET_PEER_HANDSHAKE_INACTIVITY_TIMEOUT
Definition: config.hpp:50
graphene::net::detail::node_impl::_seed_nodes
boost::container::flat_set< std::string > _seed_nodes
Definition: node_impl.hxx:632
graphene::net::detail::node_impl::_peer_inactivity_timeout
uint32_t _peer_inactivity_timeout
Definition: node_impl.hxx:533
graphene::net::detail::node_impl::get_connected_peers
std::vector< peer_status > get_connected_peers() const
Definition: node.cpp:4773
fc::asio::tcp::connect
void connect(AsyncSocket &sock, const EndpointType &ep)
wraps boost::asio::socket::async_connect
Definition: asio.hpp:262
graphene::net::detail::node_impl::bandwidth_monitor_loop
void bandwidth_monitor_loop()
Definition: node.cpp:1165
graphene::net::detail::statistics_gathering_node_delegate_wrapper::call_statistics_collector::actual_execution_measurement_helper
Definition: node_impl.hxx:309
graphene::net::detail::blockchain_tied_message_cache::size
size_t size() const
Definition: node_impl.hxx:234
graphene::net::detail::node_impl::connect_to_endpoint
void connect_to_endpoint(const fc::ip::endpoint &ep)
Definition: node.cpp:4523
graphene::net::detail::node_impl::get_active_conn_for_endpoint
peer_connection_ptr get_active_conn_for_endpoint(const fc::ip::endpoint &remote_endpoint) const
Definition: node.cpp:4536
dlog
#define dlog(FORMAT,...)
Definition: logger.hpp:100
graphene::net::peer_connection_ptr
std::shared_ptr< peer_connection > peer_connection_ptr
Definition: peer_connection.hpp:57
graphene::net::detail::node_impl::accept_connection_task
void accept_connection_task(peer_connection_ptr new_peer)
Definition: node.cpp:4015
graphene::net::detail::node_impl::_retrigger_advertise_inventory_loop_promise
fc::promise< void >::ptr _retrigger_advertise_inventory_loop_promise
Definition: node_impl.hxx:499
graphene::net::detail::node_impl::_thread
std::shared_ptr< fc::thread > _thread
Definition: node_impl.hxx:423
graphene::net::detail::node_impl
Definition: node_impl.hxx:410
fc::thread
Definition: thread.hpp:39
graphene::net::detail::concurrent_unordered_set::empty
bool empty() const noexcept
Definition: node_impl.hxx:97
graphene::net::detail::node_impl::set_advanced_node_parameters
void set_advanced_node_parameters(const fc::variant_object &params)
Definition: node.cpp:4908
config.hpp
graphene::net::detail::node_configuration::listen_endpoint
fc::ip::endpoint listen_endpoint
Definition: node_impl.hxx:396
graphene::net::detail::node_impl::accept_loop
void accept_loop()
Definition: node.cpp:4022
graphene::net::connection_accepted_message
Definition: core_messages.hpp:225
graphene::net::current_time_reply_message
Definition: core_messages.hpp:334
graphene::net::detail::node_impl::process_backlog_of_sync_blocks
void process_backlog_of_sync_blocks()
Definition: node.cpp:3136
MAX_ADDRESSES_TO_HANDLE_AT_ONCE
constexpr size_t MAX_ADDRESSES_TO_HANDLE_AT_ONCE
Definition: config.hpp:116
graphene::net::detail::node_impl::_add_once_node_list
std::list< potential_peer_record > _add_once_node_list
Definition: node_impl.hxx:444
fc::time_point_sec
Definition: time.hpp:74
graphene::net::detail::node_impl::trigger_advertise_inventory_loop
void trigger_advertise_inventory_loop()
Definition: node.cpp:851
graphene::net::detail::node_impl::listen_to_p2p_network
void listen_to_p2p_network()
Definition: node.cpp:4280
thread.hpp
graphene::net::detail::node_impl::_fetch_sync_items_loop_done
fc::future< void > _fetch_sync_items_loop_done
Definition: node_impl.hxx:456
peer_connection.hpp
graphene::net::detail::node_impl::_peers_to_delete
std::list< peer_connection_ptr > _peers_to_delete
Definition: node_impl.hxx:607
graphene::net::detail::node_impl::_avg_net_read_speed_seconds
boost::circular_buffer< uint32_t > _avg_net_read_speed_seconds
Average network read speed in the past seconds.
Definition: node_impl.hxx:572
graphene::net::detail::node_impl::network_get_usage_stats
fc::variant_object network_get_usage_stats() const
Definition: node.cpp:5013
graphene::net::detail::node_impl::fetch_updated_peer_lists_loop
void fetch_updated_peer_lists_loop()
Definition: node.cpp:1095
fc::ripemd160
Definition: ripemd160.hpp:11
GRAPHENE_NET_DEFAULT_DESIRED_CONNECTIONS
#define GRAPHENE_NET_DEFAULT_DESIRED_CONNECTIONS
Definition: config.hpp:60
graphene::net::detail::node_impl::address_builder::~address_builder
virtual ~address_builder()=default
graphene::net::detail::node_impl::_recent_block_interval_seconds
uint8_t _recent_block_interval_seconds
A cached copy of the block interval, to avoid a thread hop to the blockchain to get the current value...
Definition: node_impl.hxx:507
graphene::protocol::block_id_type
fc::ripemd160 block_id_type
Definition: types.hpp:304
graphene::net::detail::node_impl::display_current_connections
void display_current_connections()
Definition: node.cpp:1338
graphene::net::detail::node_impl::on_closing_connection_message
void on_closing_connection_message(peer_connection *originating_peer, const closing_connection_message &closing_connection_message_received)
Definition: node.cpp:2849
graphene::net::item_id::item_type
uint32_t item_type
Definition: core_messages.hpp:51
graphene::net::detail::node_impl::set_advertise_algorithm
void set_advertise_algorithm(const std::string &algo, const std::vector< std::string > &advertise_or_exclude_list)
Definition: node.cpp:2001
graphene::net::detail::node_impl::_node_public_key
node_id_t _node_public_key
Definition: node_impl.hxx:515
graphene::net::detail::node_impl::process_block_during_syncing
void process_block_during_syncing(peer_connection *originating_peer, const graphene::net::block_message &block_message, const message_hash_type &message_hash)
Definition: node.cpp:3289
graphene::net::detail::statistics_gathering_node_delegate_wrapper::handle_message
void handle_message(const message &) override
Called when a new message comes in from the network other than a block or a transaction....
Definition: node.cpp:5337
graphene::net::detail::node_impl::_retrigger_fetch_sync_items_loop_promise
fc::promise< void >::ptr _retrigger_fetch_sync_items_loop_promise
Definition: node_impl.hxx:454
graphene::net::detail::statistics_gathering_node_delegate_wrapper::call_statistics_collector::actual_execution_measurement_helper::~actual_execution_measurement_helper
~actual_execution_measurement_helper()
Definition: node_impl.hxx:318
graphene::net::detail::node_impl::_user_agent_string
std::string _user_agent_string
Definition: node_impl.hxx:509
graphene::net::detail::node_impl::advertise_inventory_loop
void advertise_inventory_loop()
Definition: node.cpp:767
graphene::net::detail::node_impl::move_peer_to_closing_list
void move_peer_to_closing_list(const peer_connection_ptr &peer)
Definition: node.cpp:4601
graphene::net::detail::node_impl::resolve_seed_node_and_add
void resolve_seed_node_and_add(const std::string &seed_string)
Definition: node.cpp:4482
graphene::net::detail::node_configuration::wait_if_endpoint_is_busy
bool wait_if_endpoint_is_busy
Definition: node_impl.hxx:400
graphene::net::detail::node_impl::network_get_info
fc::variant_object network_get_info() const
Definition: node.cpp:5004
graphene::net::detail::node_impl::on_connection_closed
void on_connection_closed(peer_connection *originating_peer) override
Definition: node.cpp:2883
graphene::net::detail::node_impl::_node_configuration_directory
fc::path _node_configuration_directory
Definition: node_impl.hxx:431
graphene::net::detail::node_impl::_items_to_fetch_updated
bool _items_to_fetch_updated
Definition: node_impl.hxx:475
graphene::net::detail::node_impl::node_impl
node_impl(const std::string &user_agent)
Definition: node.cpp:302
graphene::net::detail::node_impl::move_peer_to_active_list
void move_peer_to_active_list(const peer_connection_ptr &peer)
Definition: node.cpp:4592
graphene::net::detail::node_impl::on_current_time_reply_message
void on_current_time_reply_message(peer_connection *originating_peer, const current_time_reply_message &current_time_reply_message_received)
Definition: node.cpp:3555
graphene::net::detail::node_impl::_hard_fork_block_numbers
std::vector< uint32_t > _hard_fork_block_numbers
List of all block numbers where there are hard forks.
Definition: node_impl.hxx:557
graphene::net::detail::node_impl::get_message_for_item
graphene::net::message get_message_for_item(const item_id &item) override
Definition: node.cpp:2630
graphene::net::detail::node_impl::_max_sync_blocks_to_prefetch
size_t _max_sync_blocks_to_prefetch
Maximum number of sync blocks to prefetch.
Definition: node_impl.hxx:624
graphene::net::detail::concurrent_unordered_set::swap
void swap(typename std::unordered_set< Key, Hash, Pred > &other) noexcept
Definition: node_impl.hxx:124
fc::asio::tcp::accept
void accept(AcceptorType &acc, SocketType &sock)
wraps boost::asio::async_accept
Definition: asio.hpp:250
graphene::net::detail::node_impl::_advertise_inventory_loop_done
fc::future< void > _advertise_inventory_loop_done
Definition: node_impl.hxx:500
graphene::net::detail::node_impl::_retrigger_connect_loop_promise
fc::promise< void >::ptr _retrigger_connect_loop_promise
Definition: node_impl.hxx:447
fc::microseconds
Definition: time.hpp:12
graphene::net::detail::node_impl::address_builder::create_default_address_builder
static std::shared_ptr< address_builder > create_default_address_builder()
Definition: node.cpp:266
graphene::net::detail::statistics_gathering_node_delegate_wrapper::get_head_block_id
item_hash_t get_head_block_id() const override
Definition: node.cpp:5397
graphene::net::detail::prioritized_item_id::sequence_number
size_t sequence_number
Definition: node_impl.hxx:242
graphene::net::detail::node_impl::set_node_delegate
void set_node_delegate(std::shared_ptr< node_delegate > del, fc::thread *thread_for_delegate_calls)
Definition: node.cpp:4192
graphene::net::detail::node_impl::_maximum_number_of_connections
uint32_t _maximum_number_of_connections
Definition: node_impl.hxx:529
graphene::net::detail::node_impl::_items_to_fetch
items_to_fetch_set_type _items_to_fetch
List of items we know another peer has and we want.
Definition: node_impl.hxx:492
graphene::net::detail::node_configuration::connect_to_new_peers
bool connect_to_new_peers
Definition: node_impl.hxx:399
GRAPHENE_NET_DEFAULT_PEER_CONNECTION_RETRY_TIME
#define GRAPHENE_NET_DEFAULT_PEER_CONNECTION_RETRY_TIME
Definition: config.hpp:42
graphene::net::detail::statistics_gathering_node_delegate_wrapper::estimate_last_known_fork_from_git_revision_timestamp
uint32_t estimate_last_known_fork_from_git_revision_timestamp(uint32_t unix_timestamp) const override
Definition: node.cpp:5402
fc::time_point::now
static time_point now()
Definition: time.cpp:13
graphene::net::detail::node_impl::_suspend_fetching_sync_blocks
bool _suspend_fetching_sync_blocks
Definition: node_impl.hxx:470
graphene::net::detail::node_impl::is_item_in_any_peers_inventory
bool is_item_in_any_peers_inventory(const item_id &item) const
Definition: node.cpp:619
graphene::net::detail::node_impl::_sync_items_to_fetch_updated
bool _sync_items_to_fetch_updated
Definition: node_impl.hxx:455
graphene::net::detail::node_impl::is_hard_fork_block
bool is_hard_fork_block(uint32_t block_number) const
Definition: node.cpp:5044
graphene::net::detail::node_impl::_total_num_of_unfetched_items
uint32_t _total_num_of_unfetched_items
The number of items we still need to fetch while syncing.
Definition: node_impl.hxx:555
graphene::net::detail::node_impl::items_to_fetch_set_type
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:488
graphene::net::detail::blockchain_tied_message_cache::block_accepted
void block_accepted()
Definition: node.cpp:87
graphene::net::detail::statistics_gathering_node_delegate_wrapper::has_item
bool has_item(const graphene::net::item_id &id) override
Definition: node.cpp:5332
graphene::net::detail::node_impl::get_potential_peers
std::vector< potential_peer_record > get_potential_peers() const
Definition: node.cpp:4898
fc::time_point
Definition: time.hpp:44
graphene::net::detail::node_impl::kill_inactive_conns_loop
void kill_inactive_conns_loop(node_impl_ptr self)
Definition: node.cpp:858
graphene::net::detail::statistics_gathering_node_delegate_wrapper::get_item
message get_item(const item_id &id) override
Definition: node.cpp:5360
graphene::net::detail::node_impl::send_sync_block_to_node_delegate
void send_sync_block_to_node_delegate(const graphene::net::block_message &block_message_to_send)
Definition: node.cpp:2951
graphene::net::detail::node_impl::_last_reported_number_of_conns
uint32_t _last_reported_number_of_conns
Number of connections last reported to the client (to avoid sending duplicate messages)
Definition: node_impl.hxx:565
graphene::net::detail::concurrent_unordered_set::get_mutex
fc::mutex & get_mutex() const
Iterations require a lock. This exposes the mutex. Use with care (i.e. lock_guard)
Definition: node_impl.hxx:75
graphene::net::detail::node_impl::new_peer_just_added
void new_peer_just_added(const peer_connection_ptr &peer)
Called after a peer finishes handshaking, kicks off syncing.
Definition: node.cpp:3679
graphene::net::detail::node_impl::_actual_listening_endpoint
fc::ip::endpoint _actual_listening_endpoint
Definition: node_impl.hxx:439
logger.hpp
graphene::net::detail::node_impl::_avg_net_write_speed_minutes
boost::circular_buffer< uint32_t > _avg_net_write_speed_minutes
Average network write speed in the past minutes.
Definition: node_impl.hxx:578
graphene::net::detail::blockchain_tied_message_cache
Definition: node_impl.hxx:179
graphene::net::detail::node_impl::add_seed_node
void add_seed_node(const std::string &seed_string)
Definition: node.cpp:4437
graphene::net::detail::node_impl::on_fetch_items_message
void on_fetch_items_message(peer_connection *originating_peer, const fetch_items_message &fetch_items_message_received)
Definition: node.cpp:2647
graphene::net::detail::node_impl::_message_cache
blockchain_tied_message_cache _message_cache
Cache message we have received and might be required to provide to other peers via inventory requests...
Definition: node_impl.hxx:560
graphene::net::message_propagation_data
Definition: node.hpp:45
graphene::net::closing_connection_message
Definition: core_messages.hpp:305
graphene::net::detail::node_impl::connect_to_task
void connect_to_task(peer_connection_ptr new_peer, const fc::ip::endpoint &remote_endpoint)
Definition: node.cpp:4111
graphene::net::detail::node_impl::~node_impl
~node_impl() override
Definition: node.cpp:310
graphene::net::trx_message
Definition: core_messages.hpp:93
graphene::net::detail::node_impl::address_builder::build
void build(node_impl *impl, address_message &) const
Definition: node.cpp:271
graphene::net::detail::node_impl::address_builder
Definition: node_impl.hxx:413
graphene::net::detail::node_impl::_avg_net_usage_second_counter
size_t _avg_net_usage_second_counter
Average network usage second counter.
Definition: node_impl.hxx:584
FC_REFLECT
#define FC_REFLECT(TYPE, MEMBERS)
Specializes fc::reflector for TYPE.
Definition: reflect.hpp:388
graphene::net::detail::node_impl::on_address_request_message
void on_address_request_message(peer_connection *originating_peer, const address_request_message &)
Definition: node.cpp:1972
graphene::net::peer_connection_delegate
Definition: peer_connection.hpp:47
graphene::net::peer_connection::timestamped_items_set_type
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
Definition: peer_connection.hpp:257
graphene::net::detail::node_impl::_handle_message_calls_in_progress
std::list< fc::future< void > > _handle_message_calls_in_progress
Definition: node_impl.hxx:628
graphene::net::detail::node_impl::set_allowed_peers
void set_allowed_peers(const std::vector< node_id_t > &allowed_peers)
Definition: node.cpp:4967
graphene::net::detail::node_impl::_potential_peer_db
peer_database _potential_peer_db
Definition: node_impl.hxx:446
graphene::net::detail::node_impl::_active_connections
concurrent_unordered_set< graphene::net::peer_connection_ptr > _active_connections
Definition: node_impl.hxx:542
fc::optional
provides stack-based nullable value similar to boost::optional
Definition: optional.hpp:20
graphene::net::detail::statistics_gathering_node_delegate_wrapper::call_statistics_collector::actual_execution_measurement_helper::actual_execution_measurement_helper
actual_execution_measurement_helper(std::shared_ptr< call_statistics_collector > collector)
Definition: node_impl.hxx:313
graphene::net::detail::statistics_gathering_node_delegate_wrapper::handle_transaction
void handle_transaction(const graphene::net::trx_message &transaction_message) override
Called when a new transaction comes in from the network.
Definition: node.cpp:5348
graphene::net::detail::concurrent_unordered_set::find
std::unordered_set< Key, Hash, Pred >::const_iterator find(Key key)
Definition: node_impl.hxx:174
graphene::net::detail::node_impl::on_item_not_available_message
void on_item_not_available_message(peer_connection *originating_peer, const item_not_available_message &item_not_available_message_received)
Definition: node.cpp:2724
MAX_SYNC_BLOCKS_TO_PREFETCH
constexpr size_t MAX_SYNC_BLOCKS_TO_PREFETCH
Definition: config.hpp:119
graphene::net::detail::node_impl::_avg_net_read_speed_hours
boost::circular_buffer< uint32_t > _avg_net_read_speed_hours
Average network read speed in the past hours.
Definition: node_impl.hxx:580
graphene::net::fetch_blockchain_item_ids_message
Definition: core_messages.hpp:149
graphene::net::detail::node_impl::_max_blocks_to_handle_at_once
size_t _max_blocks_to_handle_at_once
Maximum number of blocks to handle at one time.
Definition: node_impl.hxx:622
graphene::net::detail::node_impl::_node_id
node_id_t _node_id
Definition: node_impl.hxx:524
tcp_socket.hpp
graphene::net::detail::node_impl::get_number_of_connections
uint32_t get_number_of_connections()
Definition: node.cpp:1283
graphene::net::detail::prioritized_item_id::item
item_id item
Definition: node_impl.hxx:241
graphene::net::detail::node_impl::_p2p_network_connect_loop_done
fc::future< void > _p2p_network_connect_loop_done
Definition: node_impl.hxx:449
graphene::net::detail::node_impl::_chain_id
fc::sha256 _chain_id
Definition: node_impl.hxx:427
graphene::net::detail::concurrent_unordered_set::erase
std::unordered_set< Key, Hash, Pred >::iterator erase(typename std::unordered_set< Key, Hash, Pred >::const_iterator itr)
Definition: node_impl.hxx:110
graphene::net::detail::node_impl::_node_configuration
node_configuration _node_configuration
Definition: node_impl.hxx:432
graphene::net::detail::node_impl::dump_node_status_task
void dump_node_status_task()
Definition: node.cpp:1189
graphene::net::detail::node_impl::move_peer_to_terminating_list
void move_peer_to_terminating_list(const peer_connection_ptr &peer)
Definition: node.cpp:4610
graphene::net::detail::node_impl::have_already_received_sync_item
bool have_already_received_sync_item(const item_hash_t &item_hash)
Definition: node.cpp:507
graphene::net::detail::node_impl::sync_from
void sync_from(const item_id &current_head_block, const std::vector< uint32_t > &hard_fork_block_numbers)
Definition: node.cpp:4883
graphene::net::detail::node_impl::_avg_net_read_speed_minutes
boost::circular_buffer< uint32_t > _avg_net_read_speed_minutes
Average network read speed in the past minutes.
Definition: node_impl.hxx:576
graphene::net::detail::node_impl_deleter
Definition: node_impl.hxx:833
graphene::net::detail::node_impl::get_thread
std::shared_ptr< fc::thread > get_thread() const
Definition: node_impl.hxx:424
graphene::net::detail::statistics_gathering_node_delegate_wrapper::sync_status
void sync_status(uint32_t item_type, uint32_t item_count) override
Definition: node.cpp:5375
graphene::net::detail::node_impl::trigger_fetch_sync_items_loop
void trigger_fetch_sync_items_loop()
Definition: node.cpp:610
graphene::net::detail::node_impl::_avg_net_write_speed_hours
boost::circular_buffer< uint32_t > _avg_net_write_speed_hours
Average network write speed in the past hours.
Definition: node_impl.hxx:582
graphene::net::detail::node_impl::_desired_number_of_connections
uint32_t _desired_number_of_connections
Definition: node_impl.hxx:527
graphene::net::detail::node_impl::_avg_net_write_speed_seconds
boost::circular_buffer< uint32_t > _avg_net_write_speed_seconds
Average network write speed in the past seconds.
Definition: node_impl.hxx:574
graphene::net::detail::node_impl::on_connection_rejected_message
void on_connection_rejected_message(peer_connection *originating_peer, const connection_rejected_message &connection_rejected_message_received)
Definition: node.cpp:1906
graphene
Definition: api.cpp:48
fc::future< void >
Definition: future.hpp:283
graphene::net::detail::prioritized_item_id
Definition: node_impl.hxx:239
graphene::net::detail::statistics_gathering_node_delegate_wrapper::error_encountered
void error_encountered(const std::string &message, const fc::oexception &error) override
Definition: node.cpp:5407
graphene::net::item_not_available_message
Definition: core_messages.hpp:177
graphene::net::detail::node_impl::get_peer_by_node_id
peer_connection_ptr get_peer_by_node_id(const node_id_t &id) const
Definition: node.cpp:1289
graphene::net::trx_message_type
@ trx_message_type
Definition: core_messages.hpp:68
graphene::net::detail::node_impl::schedule_next_update_seed_nodes_task
void schedule_next_update_seed_nodes_task()
Definition: node.cpp:490
graphene::net::detail::node_impl::merge_address_info_with_potential_peer_database
bool merge_address_info_with_potential_peer_database(const std::vector< address_info > addresses)
Definition: node.cpp:1308
mutex.hpp
graphene::net::detail::node_impl::_bandwidth_monitor_last_update_time
fc::time_point_sec _bandwidth_monitor_last_update_time
Definition: node_impl.hxx:588
graphene::net::detail::node_impl::process_block_when_in_sync
void process_block_when_in_sync(peer_connection *originating_peer, const graphene::net::block_message &block_message, const message_hash_type &message_hash)
Definition: node.cpp:3302
graphene::net::item_ids_inventory_message
Definition: core_messages.hpp:117
graphene::net::peer_connection
Definition: peer_connection.hpp:58
graphene::net::node_delegate
used by node reports status to client or fetch data from client
Definition: node.hpp:56
GRAPHENE_NET_MESSAGE_CACHE_DURATION_IN_BLOCKS
#define GRAPHENE_NET_MESSAGE_CACHE_DURATION_IN_BLOCKS
Definition: config.hpp:74
graphene::net::detail::statistics_gathering_node_delegate_wrapper::get_block_number
uint32_t get_block_number(const item_hash_t &block_id) override
Definition: node.cpp:5385
graphene::net::detail::node_impl::broadcast
void broadcast(const message &item_to_broadcast, const message_propagation_data &propagation_data)
Definition: node.cpp:4852
fc::tcp_server
Definition: tcp_socket.hpp:70
fc::rate_limiting_group
Definition: rate_limiting.hpp:17
graphene::net::detail::node_impl::request_sync_item_from_peer
void request_sync_item_from_peer(const peer_connection_ptr &peer, const item_hash_t &item_to_request)
Definition: node.cpp:516