clean up print statements, minimize undo/fork history

This commit is contained in:
Daniel Larimer 2015-10-07 10:15:32 -04:00
parent cb6b548dd1
commit 8e96d9c89c
6 changed files with 20 additions and 10 deletions

View file

@ -385,7 +385,13 @@ namespace detail {
{
const auto& witness = blk_msg.block.witness(*_chain_db);
const auto& witness_account = witness.witness_account(*_chain_db);
ilog("Got block #${n} with time ${t} from network with latency of ${l} ms from ${w}", ("t",blk_msg.block.timestamp)("n", blk_msg.block.block_num())("l", (latency.count()/1000))("w",witness_account.name) );
auto last_irr = _chain_db->get_dynamic_global_properties().last_irreversible_block_num;
ilog("Got block: #${n} time: ${t} latency: ${l} ms from: ${w} irreversible: ${i} (-${d})",
("t",blk_msg.block.timestamp)
("n", blk_msg.block.block_num())
("l", (latency.count()/1000))
("w",witness_account.name)
("i",last_irr)("d",blk_msg.block.block_num()-last_irr) );
}
try {
@ -515,7 +521,7 @@ namespace detail {
elog("Couldn't find block ${id} -- corresponding ID in our chain is ${id2}",
("id", id.item_hash)("id2", _chain_db->get_block_id_for_num(block_header::num_from_id(id.item_hash))));
FC_ASSERT( opt_block.valid() );
ilog("Serving up block #${num}", ("num", opt_block->block_num()));
// ilog("Serving up block #${num}", ("num", opt_block->block_num()));
return block_message(std::move(*opt_block));
}
return trx_message( _chain_db->get_recent_transaction( id.item_hash ) );

View file

@ -390,6 +390,7 @@ void database::pop_block()
{ try {
_pending_tx_session.reset();
auto head_id = head_block_id();
idump((head_id)(head_block_num()));
optional<signed_block> head_block = fetch_block_by_id( head_id );
GRAPHENE_ASSERT( head_block.valid(), pop_empty_chain, "there are no blocks to pop" );
pop_undo();

View file

@ -150,7 +150,6 @@ void database::update_active_witnesses()
const chain_property_object& cpo = get_chain_properties();
auto wits = sort_votable_objects<witness_index>(std::max(witness_count*2+1, (size_t)cpo.immutable_parameters.min_witness_count));
edump((wits.size())(witness_count*2+1));
const global_property_object& gpo = get_global_properties();
const auto& all_witnesses = get_index_type<witness_index>().indices();

View file

@ -87,8 +87,8 @@ void database::update_global_dynamic_data( const signed_block& b )
("recently_missed",_dgp.recently_missed_count)("max_undo",GRAPHENE_MAX_UNDO_HISTORY) );
}
_undo_db.set_max_size( _dgp.head_block_number - _dgp.last_irreversible_block_num + GRAPHENE_MIN_UNDO_HISTORY );
_fork_db.set_max_size( _dgp.head_block_number - _dgp.last_irreversible_block_num + GRAPHENE_MIN_UNDO_HISTORY );
_undo_db.set_max_size( _dgp.head_block_number - _dgp.last_irreversible_block_num + 1 );
_fork_db.set_max_size( _dgp.head_block_number - _dgp.last_irreversible_block_num + 1 );
}
void database::update_signing_witness(const witness_object& signing_witness, const signed_block& new_block)

View file

@ -69,7 +69,7 @@ void fork_database::_push_block(const item_ptr& item)
FC_ASSERT( item->num > std::max<int64_t>( 0, int64_t(_head->num) - (_max_size) ),
"attempting to push a block that is too old",
("item->num",item->num)("head",_head->num)("max_size",_max_size));
FC_ASSERT( item->num < _head->num + MAX_BLOCK_REORDERING );
FC_ASSERT( item->num <= _head->num + 1, "", ("item->num",item->num)("head+1",_head->num+1) );//MAX_BLOCK_REORDERING );
}
if( _head && item->previous_id() != block_id_type() )
@ -86,11 +86,15 @@ void fork_database::_push_block(const item_ptr& item)
else if( item->num > _head->num )
{
_head = item;
_index.get<block_num>().erase(_head->num - _max_size);
auto min_num = _head->num - _max_size;
// ilog( "min block in fork DB ${n}, max_size: ${m}", ("n",min_num)("m",_max_size) );
auto& num_idx = _index.get<block_num>();
while( num_idx.size() && (*num_idx.begin())->num < min_num )
num_idx.erase( num_idx.begin() );
_unlinked_index.get<block_num>().erase(_head->num - _max_size);
}
_push_next( item );
//_push_next( item );
}
/**

View file

@ -179,7 +179,7 @@ block_production_condition::block_production_condition_enum witness_plugin::bloc
ilog("Not producing block because production is disabled until we receive a recent block (see: --enable-stale-production)");
break;
case block_production_condition::not_my_turn:
ilog("Not producing block because it isn't my turn");
//ilog("Not producing block because it isn't my turn");
break;
case block_production_condition::not_time_yet:
// ilog("Not producing block because slot has not yet arrived");