Removing the version_min_m member from nano::message_header as unnecessary. Serializing this version number to/from the message_header the same as the other two version_max and version_using.
This commit is contained in:
parent
4a737c4bee
commit
fe97b2e898
3 changed files with 6 additions and 14 deletions
|
|
@ -65,7 +65,7 @@ TEST (message, publish_serialization)
|
|||
auto error (false);
|
||||
nano::message_header header (error, stream);
|
||||
ASSERT_FALSE (error);
|
||||
ASSERT_EQ (nano::dev::network_params.protocol.protocol_version_min (), header.version_min ());
|
||||
ASSERT_EQ (nano::dev::network_params.protocol.protocol_version_min (), header.version_min);
|
||||
ASSERT_EQ (nano::dev::network_params.protocol.protocol_version, header.version_using);
|
||||
ASSERT_EQ (nano::dev::network_params.protocol.protocol_version, header.version_max);
|
||||
ASSERT_EQ (nano::message_type::publish, header.type);
|
||||
|
|
|
|||
|
|
@ -53,6 +53,7 @@ nano::message_header::message_header (nano::message_type type_a) :
|
|||
network (nano::network_constants::active_network),
|
||||
version_max (get_protocol_constants ().protocol_version),
|
||||
version_using (get_protocol_constants ().protocol_version),
|
||||
version_min (get_protocol_constants ().protocol_version_min ()),
|
||||
type (type_a)
|
||||
{
|
||||
}
|
||||
|
|
@ -71,7 +72,7 @@ void nano::message_header::serialize (nano::stream & stream_a) const
|
|||
nano::write (stream_a, boost::endian::native_to_big (static_cast<uint16_t> (network)));
|
||||
nano::write (stream_a, version_max);
|
||||
nano::write (stream_a, version_using);
|
||||
nano::write (stream_a, get_protocol_constants ().protocol_version_min ());
|
||||
nano::write (stream_a, version_min);
|
||||
nano::write (stream_a, type);
|
||||
nano::write (stream_a, static_cast<uint16_t> (extensions.to_ullong ()));
|
||||
}
|
||||
|
|
@ -87,7 +88,7 @@ bool nano::message_header::deserialize (nano::stream & stream_a)
|
|||
network = static_cast<nano::networks> (boost::endian::big_to_native (network_bytes));
|
||||
nano::read (stream_a, version_max);
|
||||
nano::read (stream_a, version_using);
|
||||
nano::read (stream_a, version_min_m);
|
||||
nano::read (stream_a, version_min);
|
||||
nano::read (stream_a, type);
|
||||
uint16_t extensions_l;
|
||||
nano::read (stream_a, extensions_l);
|
||||
|
|
@ -101,12 +102,6 @@ bool nano::message_header::deserialize (nano::stream & stream_a)
|
|||
return error;
|
||||
}
|
||||
|
||||
uint8_t nano::message_header::version_min () const
|
||||
{
|
||||
debug_assert (version_min_m != std::numeric_limits<uint8_t>::max ());
|
||||
return version_min_m;
|
||||
}
|
||||
|
||||
nano::message::message (nano::message_type type_a) :
|
||||
header (type_a)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -198,14 +198,12 @@ public:
|
|||
nano::networks network;
|
||||
uint8_t version_max;
|
||||
uint8_t version_using;
|
||||
|
||||
private:
|
||||
uint8_t version_min_m{ std::numeric_limits<uint8_t>::max () };
|
||||
uint8_t version_min;
|
||||
|
||||
public:
|
||||
nano::message_type type;
|
||||
std::bitset<16> extensions;
|
||||
static size_t constexpr size = sizeof (nano::networks) + sizeof (version_max) + sizeof (version_using) + sizeof (version_min_m) + sizeof (type) + sizeof (/* extensions */ uint16_t);
|
||||
static size_t constexpr size = sizeof (nano::networks) + sizeof (version_max) + sizeof (version_using) + sizeof (version_min) + sizeof (type) + sizeof (/* extensions */ uint16_t);
|
||||
|
||||
void flag_set (uint8_t);
|
||||
static uint8_t constexpr bulk_pull_count_present_flag = 0;
|
||||
|
|
@ -216,7 +214,6 @@ public:
|
|||
static uint8_t constexpr node_id_handshake_response_flag = 1;
|
||||
bool node_id_handshake_is_query () const;
|
||||
bool node_id_handshake_is_response () const;
|
||||
uint8_t version_min () const;
|
||||
|
||||
/** Size of the payload in bytes. For some messages, the payload size is based on header flags. */
|
||||
size_t payload_length_bytes () const;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue