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.
This commit is contained in:
		
					parent
					
						
							
								6063f5f011
							
						
					
				
			
			
				commit
				
					
						c2fe0eb8f3
					
				
			
		
					 1 changed files with 3 additions and 2 deletions
				
			
		| 
						 | 
					@ -636,7 +636,7 @@ void nano::vote::serialize (nano::stream & stream_a, nano::block_type type) cons
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	write (stream_a, account);
 | 
						write (stream_a, account);
 | 
				
			||||||
	write (stream_a, signature);
 | 
						write (stream_a, signature);
 | 
				
			||||||
	write (stream_a, timestamp);
 | 
						write (stream_a, boost::endian::native_to_little (timestamp));
 | 
				
			||||||
	for (auto const & block : blocks)
 | 
						for (auto const & block : blocks)
 | 
				
			||||||
	{
 | 
						{
 | 
				
			||||||
		if (block.which ())
 | 
							if (block.which ())
 | 
				
			||||||
| 
						 | 
					@ -662,7 +662,7 @@ void nano::vote::serialize (nano::stream & stream_a) const
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
	write (stream_a, account);
 | 
						write (stream_a, account);
 | 
				
			||||||
	write (stream_a, signature);
 | 
						write (stream_a, signature);
 | 
				
			||||||
	write (stream_a, timestamp);
 | 
						write (stream_a, boost::endian::native_to_little (timestamp));
 | 
				
			||||||
	for (auto const & block : blocks)
 | 
						for (auto const & block : blocks)
 | 
				
			||||||
	{
 | 
						{
 | 
				
			||||||
		if (block.which ())
 | 
							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, account);
 | 
				
			||||||
		nano::read (stream_a, signature);
 | 
							nano::read (stream_a, signature);
 | 
				
			||||||
		nano::read (stream_a, timestamp);
 | 
							nano::read (stream_a, timestamp);
 | 
				
			||||||
 | 
							boost::endian::little_to_native_inplace (timestamp);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
		nano::block_type type;
 | 
							nano::block_type type;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue