Fixed test failures and compilation issue

This commit is contained in:
Ronak Patel 2019-09-12 19:13:36 +05:30
parent 646dc2e548
commit 9fc07f191f
3 changed files with 16 additions and 17 deletions

View file

@ -729,9 +729,9 @@ processed_transaction database::_apply_transaction(const signed_transaction& trx
ptrx.operation_results = std::move(eval_state.operation_results);
//Make sure the temp account has no non-zero balances
const auto& index = get_index_type< primary_index< account_balance_index > >().get_secondary_index< balances_by_account_index >();
auto range = index.equal_range( boost::make_tuple( GRAPHENE_TEMP_ACCOUNT ) );
std::for_each(range.first, range.second, [](const account_balance_object& b) { FC_ASSERT(b.balance == 0); });
const auto& balances = get_index_type< primary_index< account_balance_index > >().get_secondary_index< balances_by_account_index >().get_account_balances( GRAPHENE_TEMP_ACCOUNT );
for( const auto b : balances )
FC_ASSERT(b.second->balance == 0);
return ptrx;
} FC_CAPTURE_AND_RETHROW( (trx) ) }

View file

@ -295,7 +295,7 @@ void database::initialize_indexes()
add_index< primary_index<asset_dividend_data_object_index > >();
add_index< primary_index<simple_index<global_property_object >> >();
add_index< primary_index<simple_index<dynamic_global_property_object >> >();
add_index< primary_index<account_stats_index, 20 > >(); // 1 Mi
add_index< primary_index<simple_index<account_statistics_object >> >();
add_index< primary_index<simple_index<asset_dynamic_data_object >> >();
add_index< primary_index<flat_index< block_summary_object >> >();
add_index< primary_index<simple_index<chain_property_object > > >();

View file

@ -401,20 +401,19 @@ BOOST_AUTO_TEST_CASE( affiliate_payout_helper_test )
}
{
// // Fix total supply
// //auto& index = db.get_index_type<account_balance_index>().indices().get<by_account_asset>();
// auto& index = db.get_index_type< primary_index< account_balance_index, 8 > >().get_secondary_index< direct_index< account_balance_object, 8> >();
// auto itr = index.find( boost::make_tuple( account_id_type(), asset_id_type() ) );
// BOOST_CHECK( itr != nullptr );
// db.modify( *itr, [&ath]( account_balance_object& bal ) {
// bal.balance -= ath.alice_ppy + ath.ann_ppy + ath.audrey_ppy;
// });
// Fix total supply
auto& index = db.get_index_type< primary_index< account_balance_index > >().get_secondary_index<balances_by_account_index>();
auto abo = index.get_account_balance( account_id_type(), asset_id_type() );
BOOST_CHECK( abo != nullptr );
db.modify( *abo, [&ath]( account_balance_object& bal ) {
bal.balance -= ath.alice_ppy + ath.ann_ppy + ath.audrey_ppy;
});
// itr = index.find( boost::make_tuple( irene_id, btc_id ) );
// BOOST_CHECK( itr != nullptr );
// db.modify( *itr, [alice_btc,ann_btc,audrey_btc]( account_balance_object& bal ) {
// bal.balance -= alice_btc + ann_btc + audrey_btc;
// });
abo = index.get_account_balance( irene_id, btc_id );
BOOST_CHECK( abo != nullptr );
db.modify( *abo, [alice_btc,ann_btc,audrey_btc]( account_balance_object& bal ) {
bal.balance -= alice_btc + ann_btc + audrey_btc;
});
}
}