Skip to content

Commit

Permalink
Within confirm_ack, removing size calculation for vote-by-block.
Browse files Browse the repository at this point in the history
  • Loading branch information
clemahieu committed May 9, 2022
1 parent 0b44855 commit 9163cfd
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 12 deletions.
14 changes: 3 additions & 11 deletions nano/node/common.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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:
{
Expand Down Expand Up @@ -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;
}

Expand Down
2 changes: 1 addition & 1 deletion nano/node/common.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -347,7 +347,7 @@ class confirm_ack final : public message
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
Expand Down

0 comments on commit 9163cfd

Please sign in to comment.