Fixed issue where confirm_ack messages weren't serializing/deserializing correctly due to commit fe17d2ad
.
When serializing a vote to the database it needs type-prefixed serialization but when serializing to a message, the type is packed in to the header.
This commit is contained in:
parent
8022655018
commit
fc8c4383e5
3 changed files with 11 additions and 2 deletions
|
@ -363,7 +363,7 @@ bool rai::confirm_req::operator == (rai::confirm_req const & other_a) const
|
|||
|
||||
rai::confirm_ack::confirm_ack (bool & error_a, rai::stream & stream_a) :
|
||||
message (error_a, stream_a),
|
||||
vote (std::make_shared <rai::vote> (error_a, stream_a))
|
||||
vote (std::make_shared <rai::vote> (error_a, stream_a, block_type ()))
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -403,7 +403,7 @@ void rai::confirm_ack::serialize (rai::stream & stream_a)
|
|||
{
|
||||
assert (block_type () == rai::block_type::send || block_type () == rai::block_type::receive || block_type () == rai::block_type::open || block_type () == rai::block_type::change);
|
||||
write_header (stream_a);
|
||||
vote->serialize (stream_a);
|
||||
vote->serialize (stream_a, block_type ());
|
||||
}
|
||||
|
||||
bool rai::confirm_ack::operator == (rai::confirm_ack const & other_a) const
|
||||
|
|
|
@ -3654,6 +3654,14 @@ rai::uint256_union rai::vote::hash () const
|
|||
return result;
|
||||
}
|
||||
|
||||
void rai::vote::serialize (rai::stream & stream_a, rai::block_type)
|
||||
{
|
||||
write (stream_a, account);
|
||||
write (stream_a, signature);
|
||||
write (stream_a, sequence);
|
||||
block->serialize (stream_a);
|
||||
}
|
||||
|
||||
void rai::vote::serialize (rai::stream & stream_a)
|
||||
{
|
||||
write (stream_a, account);
|
||||
|
|
|
@ -338,6 +338,7 @@ public:
|
|||
rai::uint256_union hash () const;
|
||||
bool operator == (rai::vote const &) const;
|
||||
bool operator != (rai::vote const &) const;
|
||||
void serialize (rai::stream &, rai::block_type);
|
||||
void serialize (rai::stream &);
|
||||
std::string to_json () const;
|
||||
// Vote round sequence number
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue