本文整理汇总了C++中server::fetch_history方法的典型用法代码示例。如果您正苦于以下问题:C++ server::fetch_history方法的具体用法?C++ server::fetch_history怎么用?C++ server::fetch_history使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类server
的用法示例。
在下文中一共展示了server::fetch_history方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: block_generation_loop
void block_generation_loop()
{
while( !_block_gen_loop_complete.canceled() )
{
if( _pending.size() && (fc::time_point::now() - _current_block.timestamp) > fc::seconds(60) )
{
signed_block next_block;
next_block.number = _current_block.number + 1;
auto next_diff = _current_block.difficulty * 500 / _pending.size();
next_diff = (_current_block.difficulty * 99 + next_diff) / 100;
next_block.difficulty = std::max<uint64_t>(next_diff, 1000 );
next_block.timestamp = fc::time_point::now();
for( auto rec : _pending )
{
next_block.records.push_back( rec.second );
}
next_block.sign( _trustee_key );
_block_database.store(next_block.number,next_block);
for( uint32_t rec = 0; rec < next_block.records.size(); ++rec )
{
auto new_rec = next_block.records[rec];
auto hist = _self->fetch_history( new_rec.name );
hist.updates.push_back( name_index( next_block.number, rec ) );
_name_index.store( new_rec.name, hist );
_key_to_name.store( new_rec.active_key.to_base58(), new_rec.name );
}
_current_block = next_block;
_current_block_id = _current_block.id();
fc::path block_file = _data_dir / "block" / fc::to_string( uint64_t(_current_block.number) );
std::ofstream out( block_file.generic_string().c_str() );
auto block_str = fc::json::to_pretty_string( _current_block );
out.write( block_str.c_str(), block_str.size() );
}
fc::usleep( fc::seconds( 1 ) );
}
}