#125 Replace ntohl with boost::endian::endian_reverse

This commit is contained in:
Daniel Larimer 2015-07-02 12:28:15 -04:00
parent e86b1332b6
commit 5a41114d94
2 changed files with 10 additions and 14 deletions

View file

@ -97,20 +97,8 @@ namespace graphene { namespace chain {
transaction_id_type id()const;
void validate() const;
void set_expiration( fc::time_point_sec expiration_time )
{
ref_block_num = 0;
relative_expiration = 0;
ref_block_prefix = expiration_time.sec_since_epoch();
block_id_cache.reset();
}
void set_expiration( const block_id_type& reference_block, unsigned_int lifetime_intervals = 3 )
{
ref_block_num = ntohl(reference_block._hash[0]);
ref_block_prefix = reference_block._hash[1];
relative_expiration = lifetime_intervals;
block_id_cache = reference_block;
}
void set_expiration( fc::time_point_sec expiration_time );
void set_expiration( const block_id_type& reference_block, unsigned_int lifetime_intervals = 3 );
/// visit all operations
template<typename Visitor>

View file

@ -17,6 +17,7 @@
*/
#include <graphene/chain/transaction.hpp>
#include <fc/io/raw.hpp>
#include <boost/endian/conversion.hpp>
namespace graphene { namespace chain {
@ -70,5 +71,12 @@ void graphene::chain::signed_transaction::sign(const private_key_type& key)
signatures.push_back(key.sign_compact(digest()));
}
}
void transaction::set_expiration( const block_id_type& reference_block, unsigned_int lifetime_intervals )
{
ref_block_num = boost::endian::endian_reverse(reference_block._hash[0]);
ref_block_prefix = reference_block._hash[1];
relative_expiration = lifetime_intervals;
block_id_cache = reference_block;
}
} } // graphene::chain