From 55fef1b1616377e552a1f1aecca77ef9115ce18f Mon Sep 17 00:00:00 2001 From: theoreticalbts Date: Fri, 30 Oct 2015 09:57:45 -0400 Subject: [PATCH] db_update.cpp: Don't clear expired feeds for non-market-issued assets #410 --- libraries/chain/db_update.cpp | 10 ++++++---- .../chain/include/graphene/chain/asset_object.hpp | 8 ++++---- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/libraries/chain/db_update.cpp b/libraries/chain/db_update.cpp index 1fc7fc83..2b6ba2e7 100644 --- a/libraries/chain/db_update.cpp +++ b/libraries/chain/db_update.cpp @@ -366,11 +366,13 @@ void database::clear_expired_orders() void database::update_expired_feeds() { - auto& asset_idx = get_index_type().indices(); - for( const asset_object& a : asset_idx ) + auto& asset_idx = get_index_type().indices().get(); + 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()) ) diff --git a/libraries/chain/include/graphene/chain/asset_object.hpp b/libraries/chain/include/graphene/chain/asset_object.hpp index 4496fe03..1661fa7f 100644 --- a/libraries/chain/include/graphene/chain/asset_object.hpp +++ b/libraries/chain/include/graphene/chain/asset_object.hpp @@ -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_index; struct by_symbol; + struct by_type; typedef multi_index_container< asset_object, indexed_by< ordered_unique< tag, member< object, object_id_type, &object::id > >, - ordered_unique< tag, member > + ordered_unique< tag, member >, + ordered_non_unique< tag, const_mem_fun > > > asset_object_multi_index_type; typedef generic_index 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) ) -