Merge branch 'master' of github.com:cryptonomex/graphene

This commit is contained in:
Daniel Larimer 2015-09-22 16:50:48 -04:00
commit af304dc817

View file

@ -138,7 +138,7 @@ BOOST_AUTO_TEST_CASE( generate_empty_blocks )
for( uint32_t i = 1; i < 200+GRAPHENE_MIN_UNDO_HISTORY+1; ++i ) for( uint32_t i = 1; i < 200+GRAPHENE_MIN_UNDO_HISTORY+1; ++i )
{ {
BOOST_CHECK( db.head_block_id() == b.id() ); BOOST_CHECK( db.head_block_id() == b.id() );
witness_id_type prev_witness = b.witness; //witness_id_type prev_witness = b.witness;
witness_id_type cur_witness = db.get_scheduled_witness(1); witness_id_type cur_witness = db.get_scheduled_witness(1);
//BOOST_CHECK( cur_witness != prev_witness ); //BOOST_CHECK( cur_witness != prev_witness );
b = db.generate_block(db.get_slot_time(1), cur_witness, init_account_priv_key, database::skip_nothing); b = db.generate_block(db.get_slot_time(1), cur_witness, init_account_priv_key, database::skip_nothing);
@ -156,7 +156,7 @@ BOOST_AUTO_TEST_CASE( generate_empty_blocks )
for( uint32_t i = 0; i < 200; ++i ) for( uint32_t i = 0; i < 200; ++i )
{ {
BOOST_CHECK( db.head_block_id() == b.id() ); BOOST_CHECK( db.head_block_id() == b.id() );
witness_id_type prev_witness = b.witness; //witness_id_type prev_witness = b.witness;
witness_id_type cur_witness = db.get_scheduled_witness(1); witness_id_type cur_witness = db.get_scheduled_witness(1);
//BOOST_CHECK( cur_witness != prev_witness ); //BOOST_CHECK( cur_witness != prev_witness );
b = db.generate_block(db.get_slot_time(1), cur_witness, init_account_priv_key, database::skip_nothing); b = db.generate_block(db.get_slot_time(1), cur_witness, init_account_priv_key, database::skip_nothing);
@ -1029,24 +1029,20 @@ BOOST_FIXTURE_TEST_CASE( rsf_missed_blocks, database_fixture )
FC_LOG_AND_RETHROW() FC_LOG_AND_RETHROW()
} }
/** Disabled until it can be reimplemented
BOOST_FIXTURE_TEST_CASE( transaction_invalidated_in_cache, database_fixture ) BOOST_FIXTURE_TEST_CASE( transaction_invalidated_in_cache, database_fixture )
{ {
try try
{ {
ACTORS( (alice)(bob) ); ACTORS( (alice)(bob) );
auto generate_block = [&]( database& d ) -> signed_block auto generate_block = [&]( database& d, uint32_t skip = database::skip_nothing ) -> signed_block
{ {
return d.generate_block(d.get_slot_time(1), d.get_scheduled_witness(1), init_account_priv_key, database::skip_nothing); return d.generate_block(d.get_slot_time(1), d.get_scheduled_witness(1), init_account_priv_key, skip);
}; };
wdump( (db.fetch_block_by_number(1)) ); // tx's created by ACTORS() have bogus authority, so we need to
wdump( (db.fetch_block_by_id( db.head_block_id() ) ) ); // skip_authority_check in the block where they're included
signed_block b1 = generate_block(db, database::skip_authority_check);
signed_block b1 = generate_block(db);
wdump( (db.fetch_block_by_number(1)) );
wdump( (db.fetch_block_by_id( db.head_block_id() ) ) );
fc::temp_directory data_dir2( graphene::utilities::temp_directory_path() ); fc::temp_directory data_dir2( graphene::utilities::temp_directory_path() );
@ -1056,18 +1052,17 @@ BOOST_FIXTURE_TEST_CASE( transaction_invalidated_in_cache, database_fixture )
while( db2.head_block_num() < db.head_block_num() ) while( db2.head_block_num() < db.head_block_num() )
{ {
wdump( (db.head_block_num()) (db2.head_block_num()) );
optional< signed_block > b = db.fetch_block_by_number( db2.head_block_num()+1 ); optional< signed_block > b = db.fetch_block_by_number( db2.head_block_num()+1 );
db2.push_block(*b, database::skip_witness_signature); db2.push_block(*b, database::skip_witness_signature);
} }
wlog("caught up db2 to db");
BOOST_CHECK( db2.get( alice_id ).name == "alice" ); BOOST_CHECK( db2.get( alice_id ).name == "alice" );
BOOST_CHECK( db2.get( bob_id ).name == "bob" ); BOOST_CHECK( db2.get( bob_id ).name == "bob" );
db2.push_block(generate_block(db)); db2.push_block(generate_block(db));
transfer( account_id_type(), alice_id, asset( 1000 ) ); transfer( account_id_type(), alice_id, asset( 1000 ) );
transfer( account_id_type(), bob_id, asset( 1000 ) ); transfer( account_id_type(), bob_id, asset( 1000 ) );
db2.push_block(generate_block(db)); // need to skip authority check here as well for same reason as above
db2.push_block(generate_block(db, database::skip_authority_check), database::skip_authority_check);
BOOST_CHECK_EQUAL(db.get_balance(alice_id, asset_id_type()).amount.value, 1000); BOOST_CHECK_EQUAL(db.get_balance(alice_id, asset_id_type()).amount.value, 1000);
BOOST_CHECK_EQUAL(db.get_balance( bob_id, asset_id_type()).amount.value, 1000); BOOST_CHECK_EQUAL(db.get_balance( bob_id, asset_id_type()).amount.value, 1000);
@ -1134,7 +1129,7 @@ BOOST_FIXTURE_TEST_CASE( transaction_invalidated_in_cache, database_fixture )
// This needs to occur while switching to a fork. // This needs to occur while switching to a fork.
// //
signed_transaction tx_a = generate_xfer_tx( bob_id, alice_id, 1000, 3 ); signed_transaction tx_a = generate_xfer_tx( bob_id, alice_id, 1000, 2 );
signed_transaction tx_b = generate_xfer_tx( alice_id, bob_id, 2000, 10 ); signed_transaction tx_b = generate_xfer_tx( alice_id, bob_id, 2000, 10 );
signed_transaction tx_c = generate_xfer_tx( alice_id, bob_id, 500, 10 ); signed_transaction tx_c = generate_xfer_tx( alice_id, bob_id, 500, 10 );
@ -1182,7 +1177,6 @@ BOOST_FIXTURE_TEST_CASE( transaction_invalidated_in_cache, database_fixture )
throw; throw;
} }
} }
*/
BOOST_AUTO_TEST_CASE( genesis_reserve_ids ) BOOST_AUTO_TEST_CASE( genesis_reserve_ids )
{ {