db_update.cpp: Don't clear expired feeds for non-market-issued assets #410

This commit is contained in:
theoreticalbts 2015-10-30 09:57:45 -04:00
parent a1b00b2749
commit 55fef1b161
2 changed files with 10 additions and 8 deletions

View file

@ -366,11 +366,13 @@ void database::clear_expired_orders()
void database::update_expired_feeds()
{
auto& asset_idx = get_index_type<asset_index>().indices();
for( const asset_object& a : asset_idx )
auto& asset_idx = get_index_type<asset_index>().indices().get<by_type>();
auto itr = asset_idx.lower_bound( true /** market issued */ );
while( itr != asset_idx.end() )
{
if( !a.is_market_issued() )
continue;
const asset_object& a = *itr;
++itr;
assert( a.is_market_issued() );
const asset_bitasset_data_object& b = a.bitasset_data(*this);
if( b.feed_is_expired(head_block_time()) )

View file

@ -213,7 +213,6 @@ namespace graphene { namespace chain {
void update_median_feeds(time_point_sec current_time);
};
struct by_feed_expiration;
typedef multi_index_container<
asset_bitasset_data_object,
@ -227,17 +226,19 @@ namespace graphene { namespace chain {
typedef flat_index<asset_bitasset_data_object> asset_bitasset_data_index;
struct by_symbol;
struct by_type;
typedef multi_index_container<
asset_object,
indexed_by<
ordered_unique< tag<by_id>, member< object, object_id_type, &object::id > >,
ordered_unique< tag<by_symbol>, member<asset_object, string, &asset_object::symbol> >
ordered_unique< tag<by_symbol>, member<asset_object, string, &asset_object::symbol> >,
ordered_non_unique< tag<by_type>, const_mem_fun<asset_object, bool, &asset_object::is_market_issued> >
>
> asset_object_multi_index_type;
typedef generic_index<asset_object, asset_object_multi_index_type> asset_index;
} } // graphene::chain
FC_REFLECT_DERIVED( graphene::chain::asset_dynamic_data_object, (graphene::db::object),
(current_supply)(confidential_supply)(accumulated_fees)(fee_pool) )
@ -260,4 +261,3 @@ FC_REFLECT_DERIVED( graphene::chain::asset_object, (graphene::db::object),
(dynamic_asset_data_id)
(bitasset_data_id)
)