Fix unit test failure due to skip_flags changes caused by #492 fix

This commit is contained in:
theoreticalbts 2016-02-15 16:56:14 -05:00
parent 4a6de2fba7
commit 32f07de4e2
3 changed files with 18 additions and 9 deletions

View file

@ -320,20 +320,20 @@ void database_fixture::generate_blocks( uint32_t block_count )
generate_block(); generate_block();
} }
void database_fixture::generate_blocks(fc::time_point_sec timestamp, bool miss_intermediate_blocks) void database_fixture::generate_blocks(fc::time_point_sec timestamp, bool miss_intermediate_blocks, uint32_t skip)
{ {
if( miss_intermediate_blocks ) if( miss_intermediate_blocks )
{ {
generate_block(); generate_block(skip);
auto slots_to_miss = db.get_slot_at_time(timestamp); auto slots_to_miss = db.get_slot_at_time(timestamp);
if( slots_to_miss <= 1 ) if( slots_to_miss <= 1 )
return; return;
--slots_to_miss; --slots_to_miss;
generate_block(~0, init_account_priv_key, slots_to_miss); generate_block(skip, init_account_priv_key, slots_to_miss);
return; return;
} }
while( db.head_block_time() < timestamp ) while( db.head_block_time() < timestamp )
generate_block(); generate_block(skip);
} }
account_create_operation database_fixture::make_account( account_create_operation database_fixture::make_account(

View file

@ -183,7 +183,7 @@ struct database_fixture {
* @brief Generates blocks until the head block time matches or exceeds timestamp * @brief Generates blocks until the head block time matches or exceeds timestamp
* @param timestamp target time to generate blocks until * @param timestamp target time to generate blocks until
*/ */
void generate_blocks(fc::time_point_sec timestamp, bool miss_intermediate_blocks = true); void generate_blocks(fc::time_point_sec timestamp, bool miss_intermediate_blocks = true, uint32_t skip = ~0);
account_create_operation make_account( account_create_operation make_account(
const std::string& name = "nathan", const std::string& name = "nathan",

View file

@ -620,14 +620,23 @@ BOOST_AUTO_TEST_CASE( fee_refund_test )
int64_t order_create_fee = 537; int64_t order_create_fee = 537;
int64_t order_cancel_fee = 129; int64_t order_cancel_fee = 129;
generate_block(); uint32_t skip = database::skip_witness_signature
| database::skip_transaction_signatures
| database::skip_transaction_dupe_check
| database::skip_block_size_check
| database::skip_tapos_check
| database::skip_authority_check
| database::skip_merkle_check
;
generate_block( skip );
for( int i=0; i<2; i++ ) for( int i=0; i<2; i++ )
{ {
if( i == 1 ) if( i == 1 )
{ {
generate_blocks( HARDFORK_445_TIME ); generate_blocks( HARDFORK_445_TIME, true, skip );
generate_block(); generate_block( skip );
} }
// enable_fees() and change_fees() modifies DB directly, and results will be overwritten by block generation // enable_fees() and change_fees() modifies DB directly, and results will be overwritten by block generation
@ -719,7 +728,7 @@ BOOST_AUTO_TEST_CASE( fee_refund_test )
// but we'll save that for future cleanup // but we'll save that for future cleanup
// undo above tx's and reset // undo above tx's and reset
generate_block(); generate_block( skip );
db.pop_block(); db.pop_block();
} }
} }