diff --git a/libraries/app/application.cpp b/libraries/app/application.cpp index 66dcfbc7..08f14d35 100644 --- a/libraries/app/application.cpp +++ b/libraries/app/application.cpp @@ -4,7 +4,7 @@ * * Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: * - * 1. Any modified source or binaries are used only with the BitShares network. + * 1. Any modified source or binaries are used only with the MUSE network. * * 2. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. * diff --git a/libraries/chain/asset_evaluator.cpp b/libraries/chain/asset_evaluator.cpp index 81f35fb2..e43e4feb 100644 --- a/libraries/chain/asset_evaluator.cpp +++ b/libraries/chain/asset_evaluator.cpp @@ -52,7 +52,7 @@ void_result asset_create_evaluator::do_evaluate( const asset_create_operation& o auto dotpos = op.symbol.find( '.' ); if( dotpos != std::string::npos && d.head_block_time() > HARDFORK_385_TIME ) { auto prefix = op.symbol.substr( 0, dotpos ); - auto asset_symbol_itr = asset_indx.find( op.symbol ); + auto asset_symbol_itr = asset_indx.find( prefix ); FC_ASSERT( asset_symbol_itr != asset_indx.end(), "Asset ${s} may only be created by issuer of ${p}, but ${p} has not been registered", ("s",op.symbol)("p",prefix) ); FC_ASSERT( asset_symbol_itr->issuer == op.issuer, "Asset ${s} may only be created by issuer of ${p}, ${i}", diff --git a/libraries/chain/asset_object.cpp b/libraries/chain/asset_object.cpp index d08e0e43..91862e4d 100644 --- a/libraries/chain/asset_object.cpp +++ b/libraries/chain/asset_object.cpp @@ -43,7 +43,19 @@ share_type asset_bitasset_data_object::max_force_settlement_volume(share_type cu void graphene::chain::asset_bitasset_data_object::update_median_feeds(time_point_sec current_time) { current_feed_publication_time = current_time; + auto cutoff = current_time - options.feed_lifetime_sec; + + for( auto itr = feeds.begin(); itr != feeds.end(); ) + { + if( itr->second.first < cutoff ) + itr = feeds.erase(itr); + else + ++itr; + } + + vector> current_feeds; + current_feeds.reserve(feeds.size()); for( const pair>& f : feeds ) { if( (current_time - f.second.first).to_seconds() < options.feed_lifetime_sec && diff --git a/libraries/chain/db_update.cpp b/libraries/chain/db_update.cpp index 1fc7fc83..a3c1cab0 100644 --- a/libraries/chain/db_update.cpp +++ b/libraries/chain/db_update.cpp @@ -233,11 +233,13 @@ bool database::check_for_blackswan( const asset_object& mia, bool enable_black_s auto least_collateral = call_itr->collateralization(); if( ~least_collateral >= highest ) { - elog( "Black Swan detected: \n" + elog( "Black Swan detected ${s}/${s1}: \n" " Least collateralized call: ${lc} ${~lc}\n" // " Highest Bid: ${hb} ${~hb}\n" " Settle Price: ${sp} ${~sp}\n" " Max: ${h} ${~h}\n", + ("s", settle_price.base.asset_id(*this).symbol ) + ("s1", settle_price.quote.asset_id(*this).symbol ) ("lc",least_collateral.to_real())("~lc",(~least_collateral).to_real()) // ("hb",limit_itr->sell_price.to_real())("~hb",(~limit_itr->sell_price).to_real()) ("sp",settle_price.to_real())("~sp",(~settle_price).to_real()) @@ -366,11 +368,17 @@ 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 */ ); + //for( const asset_object& a : asset_idx ) + while( itr != asset_idx.end() ) { + const asset_object& a = *itr; + ++itr; + /* if( !a.is_market_issued() ) continue; + */ 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..c05673a8 100644 --- a/libraries/chain/include/graphene/chain/asset_object.hpp +++ b/libraries/chain/include/graphene/chain/asset_object.hpp @@ -227,11 +227,13 @@ 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;