From c2fe0eb8f30a15e7e567521b1b4999b83c4092ef Mon Sep 17 00:00:00 2001 From: dsiganos Date: Wed, 13 Oct 2021 14:36:01 +0100 Subject: [PATCH] Endianess fix for vote timestamp field (does not affect x86) (#3500) This change will have no effect on little endianess machines (x86). But it would fix big endian machines. --- nano/secure/common.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/nano/secure/common.cpp b/nano/secure/common.cpp index 879c8925..b809b668 100644 --- a/nano/secure/common.cpp +++ b/nano/secure/common.cpp @@ -636,7 +636,7 @@ void nano::vote::serialize (nano::stream & stream_a, nano::block_type type) cons { write (stream_a, account); write (stream_a, signature); - write (stream_a, timestamp); + write (stream_a, boost::endian::native_to_little (timestamp)); for (auto const & block : blocks) { if (block.which ()) @@ -662,7 +662,7 @@ void nano::vote::serialize (nano::stream & stream_a) const { write (stream_a, account); write (stream_a, signature); - write (stream_a, timestamp); + write (stream_a, boost::endian::native_to_little (timestamp)); for (auto const & block : blocks) { if (block.which ()) @@ -685,6 +685,7 @@ bool nano::vote::deserialize (nano::stream & stream_a, nano::block_uniquer * uni nano::read (stream_a, account); nano::read (stream_a, signature); nano::read (stream_a, timestamp); + boost::endian::little_to_native_inplace (timestamp); nano::block_type type;