Increase logging, improve error messages

This commit is contained in:
theoreticalbts 2015-09-17 11:23:55 -04:00
parent 60f6833795
commit b9727e6e1c
5 changed files with 10 additions and 8 deletions

View file

@ -102,7 +102,7 @@ std::vector<block_id_type> database::get_block_ids_on_fork(block_id_type head_of
*/ */
bool database::push_block(const signed_block& new_block, uint32_t skip) bool database::push_block(const signed_block& new_block, uint32_t skip)
{ {
idump((new_block.block_num())(new_block.id())); //idump((new_block.block_num())(new_block.id())(new_block.timestamp)(new_block.previous));
bool result; bool result;
detail::with_skip_flags( *this, skip, [&]() detail::with_skip_flags( *this, skip, [&]()
{ {
@ -131,6 +131,7 @@ bool database::_push_block(const signed_block& new_block)
//Only switch forks if new_head is actually higher than head //Only switch forks if new_head is actually higher than head
if( new_head->data.block_num() > head_block_num() ) if( new_head->data.block_num() > head_block_num() )
{ {
wlog( "Switching to fork: ${id}", ("id",new_head->data.id()) );
auto branches = _fork_db.fetch_branch_from(new_head->data.id(), head_block_id()); auto branches = _fork_db.fetch_branch_from(new_head->data.id(), head_block_id());
// pop blocks until we hit the forked block // pop blocks until we hit the forked block

View file

@ -103,7 +103,6 @@ void database::open(
const fc::path& data_dir, const fc::path& data_dir,
std::function<genesis_state_type()> genesis_loader ) std::function<genesis_state_type()> genesis_loader )
{ {
elog( "Open Database" );
try try
{ {
object_database::open(data_dir); object_database::open(data_dir);
@ -123,7 +122,7 @@ void database::open(
FC_ASSERT( head_block_num() == 0, "last block ID does not match current chain state" ); FC_ASSERT( head_block_num() == 0, "last block ID does not match current chain state" );
} }
} }
idump((head_block_id())(head_block_num())); //idump((head_block_id())(head_block_num()));
} }
FC_CAPTURE_AND_RETHROW( (data_dir) ) FC_CAPTURE_AND_RETHROW( (data_dir) )
} }
@ -139,7 +138,7 @@ void database::close(uint32_t blocks_to_rewind)
{ {
while( true ) while( true )
{ {
elog("pop"); // elog("pop");
block_id_type popped_block_id = head_block_id(); block_id_type popped_block_id = head_block_id();
pop_block(); pop_block();
_fork_db.remove(popped_block_id); // doesn't throw on missing _fork_db.remove(popped_block_id); // doesn't throw on missing

View file

@ -94,9 +94,10 @@ struct pending_transactions_restorer
} }
catch( const fc::exception& e ) catch( const fc::exception& e )
{ {
wlog( "Pending transaction became invalid after switching to block ${b}", ("b", _db.head_block_id()) ); /*
wlog( "The invalid pending transaction is ${t}", ("t", tx) ); wlog( "Pending transaction became invalid after switching to block ${b} ${t}", ("b", _db.head_block_id())("t",_db.head_block_time()) );
wlog( "The invalid pending transaction caused exception ${e}", ("e", e) ); wlog( "The invalid pending transaction caused exception ${e}", ("e", e.to_detail_string() ) );
*/
} }
} }
} }

View file

@ -58,7 +58,7 @@ void_result proposal_create_evaluator::do_evaluate(const proposal_create_operati
GRAPHENE_ASSERT( GRAPHENE_ASSERT(
*o.review_period_seconds >= global_parameters.committee_proposal_review_period, *o.review_period_seconds >= global_parameters.committee_proposal_review_period,
proposal_create_review_period_insufficient, proposal_create_review_period_insufficient,
"Review period of ${t} required, but at least ${min} required", "Review period of ${t} specified, but at least ${min} required",
("t", *o.review_period_seconds) ("t", *o.review_period_seconds)
("min", global_parameters.committee_proposal_review_period) ("min", global_parameters.committee_proposal_review_period)
); );

View file

@ -557,6 +557,7 @@ BOOST_FIXTURE_TEST_CASE( fired_committee_members, database_fixture )
PUSH_TX( db, trx, ~0 ); PUSH_TX( db, trx, ~0 );
trx.operations.clear(); trx.operations.clear();
} }
idump((get_balance(*nathan, asset_id_type()(db))));
// still no money // still no money
BOOST_CHECK_EQUAL(get_balance(*nathan, asset_id_type()(db)), 5000); BOOST_CHECK_EQUAL(get_balance(*nathan, asset_id_type()(db)), 5000);