Within confirm_ack, removing size calculation for vote-by-block.

This commit is contained in:
clemahieu 2022-05-09 13:02:13 +01:00
commit aeed10f48b
No known key found for this signature in database
GPG key ID: 43708520C8DFB938
2 changed files with 4 additions and 12 deletions

View file

@ -285,7 +285,7 @@ std::size_t nano::message_header::payload_length_bytes () const
}
case nano::message_type::confirm_ack:
{
return nano::confirm_ack::size (block_type (), count_get ());
return nano::confirm_ack::size (count_get ());
}
case nano::message_type::confirm_req:
{
@ -860,17 +860,9 @@ void nano::confirm_ack::visit (nano::message_visitor & visitor_a) const
visitor_a.confirm_ack (*this);
}
std::size_t nano::confirm_ack::size (nano::block_type type_a, std::size_t count)
std::size_t nano::confirm_ack::size (std::size_t count)
{
std::size_t result (sizeof (nano::account) + sizeof (nano::signature) + sizeof (uint64_t));
if (type_a != nano::block_type::invalid && type_a != nano::block_type::not_a_block)
{
result += nano::block::size (type_a);
}
else if (type_a == nano::block_type::not_a_block)
{
result += count * sizeof (nano::block_hash);
}
std::size_t result = sizeof (nano::account) + sizeof (nano::signature) + sizeof (uint64_t) + count * sizeof (nano::block_hash);
return result;
}

View file

@ -347,7 +347,7 @@ public:
void visit (nano::message_visitor &) const override;
bool operator== (nano::confirm_ack const &) const;
std::shared_ptr<nano::vote> vote;
static std::size_t size (nano::block_type, std::size_t = 0);
static std::size_t size (std::size_t count);
};
class frontier_req final : public message