MCPcopy Create free account
hub / github.com/bitshares/bitshares-core / generate_hello_user_data

Method generate_hello_user_data

libraries/net/node.cpp:1454–1488  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1452
1453
1454 fc::variant_object node_impl::generate_hello_user_data()
1455 {
1456 VERIFY_CORRECT_THREAD();
1457 // for the time being, shoehorn a bunch of properties into the user_data variant object,
1458 // which lets us add and remove fields without changing the protocol. Once we
1459 // settle on what we really want in there, we'll likely promote them to first
1460 // class fields in the hello message
1461 fc::mutable_variant_object user_data;
1462 user_data["fc_git_revision_sha"] = fc::git_revision_sha;
1463 user_data["fc_git_revision_unix_timestamp"] = fc::git_revision_unix_timestamp;
1464#if defined( __APPLE__ )
1465 user_data["platform"] = "osx";
1466#elif defined( __OpenBSD__ )
1467 user_data["platform"] = "obsd";
1468#elif defined( __linux__ )
1469 user_data["platform"] = "linux";
1470#elif defined( _MSC_VER )
1471 user_data["platform"] = "win32";
1472#else
1473 user_data["platform"] = "other";
1474#endif
1475 user_data["bitness"] = sizeof(void*) * 8;
1476
1477 user_data["node_id"] = fc::variant( _node_id, 1 );
1478
1479 item_hash_t head_block_id = _delegate->get_head_block_id();
1480 user_data["last_known_block_hash"] = fc::variant( head_block_id, 1 );
1481 user_data["last_known_block_number"] = _delegate->get_block_number(head_block_id);
1482 user_data["last_known_block_time"] = _delegate->get_block_time(head_block_id);
1483
1484 if (!_hard_fork_block_numbers.empty())
1485 user_data["last_known_fork_block_number"] = _hard_fork_block_numbers.back();
1486
1487 return user_data;
1488 }
1489 void node_impl::parse_hello_user_data_for_peer(peer_connection* originating_peer, const fc::variant_object& user_data)
1490 {
1491 VERIFY_CORRECT_THREAD();

Callers

nothing calls this directly

Calls 4

variantClass · 0.85
get_head_block_idMethod · 0.45
get_block_numberMethod · 0.45
get_block_timeMethod · 0.45

Tested by

no test coverage detected