database: Implement before_last_checkpoint() function

This commit is contained in:
theoreticalbts 2015-09-24 17:07:01 -04:00
parent 1fb327f6a0
commit 35acfff060
2 changed files with 6 additions and 0 deletions

View file

@ -643,4 +643,9 @@ void database::add_checkpoints( const flat_map<uint32_t,block_id_type>& checkpts
_checkpoints[i.first] = i.second;
}
bool database::before_last_checkpoint()const
{
return (_checkpoints.size() > 0) && (_checkpoints.rbegin()->first >= head_block_num());
}
} }

View file

@ -122,6 +122,7 @@ namespace graphene { namespace chain {
void add_checkpoints( const flat_map<uint32_t,block_id_type>& checkpts );
const flat_map<uint32_t,block_id_type> get_checkpoints()const { return _checkpoints; }
bool before_last_checkpoint()const;
bool push_block( const signed_block& b, uint32_t skip = skip_nothing );
processed_transaction push_transaction( const signed_transaction& trx, uint32_t skip = skip_nothing );