MCPcopy Create free account
hub / github.com/cryptonomex/graphene / generate_hello_user_data

Method generate_hello_user_data

libraries/net/node.cpp:1823–1855  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1821
1822
1823 fc::variant_object node_impl::generate_hello_user_data()
1824 {
1825 VERIFY_CORRECT_THREAD();
1826 // for the time being, shoehorn a bunch of properties into the user_data variant object,
1827 // which lets us add and remove fields without changing the protocol. Once we
1828 // settle on what we really want in there, we'll likely promote them to first
1829 // class fields in the hello message
1830 fc::mutable_variant_object user_data;
1831 user_data["fc_git_revision_sha"] = fc::git_revision_sha;
1832 user_data["fc_git_revision_unix_timestamp"] = fc::git_revision_unix_timestamp;
1833#if defined( __APPLE__ )
1834 user_data["platform"] = "osx";
1835#elif defined( __linux__ )
1836 user_data["platform"] = "linux";
1837#elif defined( _MSC_VER )
1838 user_data["platform"] = "win32";
1839#else
1840 user_data["platform"] = "other";
1841#endif
1842 user_data["bitness"] = sizeof(void*) * 8;
1843
1844 user_data["node_id"] = _node_id;
1845
1846 item_hash_t head_block_id = _delegate->get_head_block_id();
1847 user_data["last_known_block_hash"] = head_block_id;
1848 user_data["last_known_block_number"] = _delegate->get_block_number(head_block_id);
1849 user_data["last_known_block_time"] = _delegate->get_block_time(head_block_id);
1850
1851 if (!_hard_fork_block_numbers.empty())
1852 user_data["last_known_fork_block_number"] = _hard_fork_block_numbers.back();
1853
1854 return user_data;
1855 }
1856 void node_impl::parse_hello_user_data_for_peer(peer_connection* originating_peer, const fc::variant_object& user_data)
1857 {
1858 VERIFY_CORRECT_THREAD();

Callers

nothing calls this directly

Calls 3

get_head_block_idMethod · 0.80
get_block_numberMethod · 0.80
get_block_timeMethod · 0.80

Tested by

no test coverage detected